⊗jsagPmCMCPT 65 of 97 menu

Passing Text to Child Component in Angular

You can pass text from a parent component to a child component. To do this, you need to write the text to be passed between the opening and closing tags of the child component. Let's do this:

<user-data> text from parent </user-data>

Now in the child component template we must specify the place where the passed parent text will be inserted. This is done using a special tag ng-content. Let's put this tag in the child component template:

child text <br> <ng-content></ng-content>

Let's say there is some property in the parent component. Insert the value of this property into the text. Pass this text to the child component in the way described in the lesson.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline