Angular Component 05 : Components ng-content

Yuvaraj S
May 4, 2022

--

Previous Blog:
Angular Components 04 — @viewchild

Created a component and named template. Here we wrote <ng-content></ng-content>

template.component.html

In app.component.html, took this component selector <app-template></app-template>

app.component.html

inside out component we are writing one paragraph tag, inside we are giving my content as a string Interpolation. One way data binding.

app.component.ts

Here is our output, in output we can see the mycontent value that we gave.

Output of ng-content

Stackblitz Link
https://stackblitz.com/edit/angular-component-ng-content

Next Blog:
Angular Component 06: Directives — *ngIf and *ngFor

— — — — — — — — — — — End of Lecture — — — — — — — — — — — —

Full Blog of my angular concepts (all lessons)
https://medium.com/@yuvayuvaraj720444/angular-intermediate-lessons-acbea2dfc9b

--

--

Yuvaraj S

Frontend Developer with 6years of experience, I write blogs that are [Easy words + Ground Level Code + Live Working Link]. Angular | React | Javascript | CSS