angular 10 get component name or id 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);
}