Thursday, September 15, 2022

The complete book on angular 11 - Chapter 4 Built-in Directives

 The complete book on angular 11 - Chapter 4 Built-in Directives

1. ngSwitch

<div class="container" [ngSwitch]="myVar">

<div *ngSwitchCase="'A'">Var is A</div>

<div *ngSwitchCase="'B'">Var is B</div>

<div *ngSwitchDefault>Var is something else</div>

</div>

2. NgStyle

<div [style.background-color]="'yellow'">

Uses fixed yellow background

</div>

<div [ngStyle]="{color: 'white', 'background-color': 'blue'}">

Uses fixed white text on blue background

</div>

3. ngClass

<div [ngClass]="{bordered: false}">This is never bordered</div>

4. ngNonBindable

<div class='ngNonBindableDemo'>

<span class="bordered">{{ content }}</span>

<span class="pre" ngNonBindable>

&larr; This is what {{ content }} rendered

</span>

</div>

TODO Forms in Angular

No comments:

Post a Comment