Issue
hello i am having issues initializing viewchild elementRef this always work fine for me but in angular 13 i am having an error message
@ViewChild("text", { static: true }) text : ElementRef;
Property 'text' has no initializer and is not definitely assigned in the constructor
Thanks
Solution
Change it to.
@ViewChild("text", { static: true }) text!: ElementRef;
Read more
- Property 'text' has no initializer and is not definitely assigned in the constructor
- Not null assertion operator
Answered By - Naren Murali