0

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

1 Answers1

0

Change it to.

@ViewChild("text", { static: true }) text!: ElementRef;

Read more

  1. Property 'text' has no initializer and is not definitely assigned in the constructor
  2. Not null assertion operator
Naren Murali
  • 19,250
  • 3
  • 27
  • 54