⊗jsagPmCdIDO 22 of 97 menu

Comparison operators in if directive in Angular

In the *ngIf directive, you can use the comparison operators we are used to.

Let's look at an example. Let's say we have the following numeric variable:

export class AppComponent { public num: number = 1; }

Let's show a block of text depending on the condition:

<div *ngIf="num === 1"> text </div>

Let variable age store the user's age. Show adult text if the user's age is greater than 18 years.

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