Skip to content

Instantly share code, notes, and snippets.

@vxhviet
Last active November 9, 2018 08:44
Show Gist options
  • Save vxhviet/997293c446091034020a80c0bb4824df to your computer and use it in GitHub Desktop.
Save vxhviet/997293c446091034020a80c0bb4824df to your computer and use it in GitHub Desktop.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment