Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to bind two ng-content in a component angular

app.comp.html
<app-child>
    <div header >This should be rendered in header selection of ng-content</div>
    <div body >This should be rendered in body selection of ng-content</div>
</app-child>

child.comp.html
<div class="header-css-class">
    <ng-content select="[header]"></ng-content>
</div>
<div class="body-css-class">
    <ng-content select="[body]"></ng-content>
</div>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #bind #component #angular
ADD COMMENT
Topic
Name
6+4 =