I have referenced a control with ElementRef of Angular and for this I use this code:
HTML :
<button #btnSaveGeneralData...
Typescript :
@ViewChild ('btnSaveGeneralData') btnSaveGeneralData: ElementRef;
I need to reference to be able to reach the click () event, with javascript I have solved it:
let buttonDG: any = document.getElementsByName ('btnGaveDG') [0];
buttonDG.click ();
but doing so with ElementRef does not work, I get the error "... nativeElement undefined":
this.btnSaveGeneralData.nativeElement.click ();
I could do it with javascript but it's not the idea. Any suggestions, in which I can be wrong?
Thank you.