@viewChild not working - cannot read property nativeElement of undefined

后端 未结 8 1939
孤街浪徒
孤街浪徒 2020-12-05 06:00

I\'m trying to access a native element in order to focus on it when another element is clicked (much like the html attribute \"for\" - for cannot be used on elements of th

8条回答
  •  南笙
    南笙 (楼主)
    2020-12-05 06:38

    Initializing the Canvas like below works for TypeScript/Angular solutions.

    const canvas =  document.getElementById("htmlElemId"); 
    
    const context = canvas.getContext("2d"); 
    

提交回复
热议问题