Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get ng content element angular 2

@Component({
    selector: 'upper',
    template: `<ng-content></ng-content>`
})
export class UpperComponent {
    @ContentChild(SomeComponent) content: SomeComponent;
}
Comment

get ng content element angular 2

@Component({
  selector: 'upper',
  template: `<ng-content></ng-content>`
})
export class UpperComponent {
  constructor(private elt:ElementRef, private renderer:Renderer) {
  }

  ngAfterViewInit() {
    var textNode = this.elt.nativeElement.childNodes[0];
    var textInput = textNode.nodeValue;
    this.renderer.setText(textNode, textInput.toUpperCase());
  }
}
Comment

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);
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to just have createdAt mongoose 
Javascript :: vuejs form prevent default event 
Javascript :: jquery in react 
Javascript :: moment date add 
Javascript :: jquery cast to string 
Javascript :: detox scroll to element 
Javascript :: react or vue 
Javascript :: map dictionary javascript 
Javascript :: js parse url decode 
Javascript :: leaflet change zoom button position 
Javascript :: js map value in range 
Javascript :: js fullscreen 
Javascript :: google charts hide legend 
Javascript :: update angular cli 10 
Javascript :: fs.writefile 
Javascript :: loop n times js 
Javascript :: regex password validation 
Javascript :: play iframe video onclick a link javascript 
Javascript :: pass js var to laravel route 
Javascript :: jsconfig alias 
Javascript :: js nwe date today 
Javascript :: how to select all elements of type js 
Javascript :: discord.js channel regex 
Javascript :: ionic (Emitted value instead of an instance of Error 
Javascript :: make button disabled 
Javascript :: create a link javascript 
Javascript :: pattern cpf js 
Javascript :: import json typescript 
Javascript :: js pixelated 
Javascript :: import withrouter 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =