vxh.viet
11/9/2018 - 8:39 AM

Angular - Pass Component into Component

Angular - Pass Component into Component

SOURCE

Use ng-content (not ng-template) to pass component into component:

<!-- component A -->
<div>
  ....
  <ng-content></ng-content>
</div>


<!-- Pass component B into component A like this -->
<app-component-a>
  <app-component-b></app-component-b>
</app-component-a>