Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

angular elementref

// in template
//<div #myEl></div>

@ViewChild("myEl") el: ElementRef;

ngAfterViewInit(){
  this.el.nativeElement.innerHTML = "Hi";
  console.log(this.el);
}
 
PREVIOUS NEXT
Tagged: #angular #elementref
ADD COMMENT
Topic
Name
7+6 =