Comparison operators in if statement in Angular
The @if construct can also use comparison operators.
Let's see how this is done. 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:
@if (num === 1) {
<div>
text
</div>
}
Let the property age store the user's age. Show adult text if the user's age is greater than 18 years.