如何将JavaScript代码document.queryselector转换为Angular9?
我有JavaScript代码编写的代码为let input = document.queryselector(“#input”);
> 我
input.addEventListener('click', function() {
canvas.getContext('2d').drawImage(input, 0, 0, canvas.width, canvas.height);
let image_data_url = canvas.toDataURL('image/jpeg');
});
想用Angular编写此代码,如何在Angular9项目中转换和使用此代码,任何人请帮助我
I have code which is written in JavaScript code as let input= document.querySelector("#input");
and
input.addEventListener('click', function() {
canvas.getContext('2d').drawImage(input, 0, 0, canvas.width, canvas.height);
let image_data_url = canvas.toDataURL('image/jpeg');
});
I want to write this code in angular how can I convert and use this code in angular9 project anyone please help me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最好的方法就是这样:
在您的.TS文件中
the best way to do it is like this:
and in your .ts file