angular 10 element ref code example
Example: angular elementref
// in template
//<div #myEl></div>
@ViewChild("myEl") el: ElementRef;
ngAfterViewInit(){
this.el.nativeElement.innerHTML = "Hi";
console.log(this.el);
}
// in template
//<div #myEl></div>
@ViewChild("myEl") el: ElementRef;
ngAfterViewInit(){
this.el.nativeElement.innerHTML = "Hi";
console.log(this.el);
}