Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get ng content element angular 2

@Component({
    selector: 'upper',
    template: `
  <div #contentWrapper>
    <ng-content></ng-content>
  </div>`
})
export class UpperComponent {
    @ViewChild('contentWrapper') content: ElementRef;

    ngAfterViewInit() {
      console.log(this.content.nativeElement);
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ng #content #element #angular
ADD COMMENT
Topic
Name
4+3 =