⊗jsagPmTpCPAt 15 of 97 menu

Component class properties in Angular attributes

You can display public properties of a class not only in the text of tags, but also as attribute values. Let's look at this in practice. Let's say our class has the following property:

export class AppComponent { public test: string = 'abcde'; }

Let's output the contents of our property in the tag attribute:

<div id="{{ test }}"> text </div>

The following layout is given:

<img src="test.png" alt="picture">

Make the attributes content come from the component class.

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