Angular 2: Difference between revisions

Jump to navigation Jump to search
add built-in components
Line 12: Line 12:
=== <nowiki>*ngSwitch</nowiki> ===
=== <nowiki>*ngSwitch</nowiki> ===


<syntaxhighlight lang="html">
<div class="container" [ngSwitch]="myVar">
<div class="container" [ngSwitch]="myVar">
   <div *ngSwitchWhen="'A'">Var is A</div>
   <div *ngSwitchWhen="'A'">Var is A</div>
Line 17: Line 18:
   <div *ngSwitchDefault>Var is something else</div>
   <div *ngSwitchDefault>Var is something else</div>
</div>
</div>
</syntaxhighlight>


=== <nowiki>*ngStyle</nowiki> ===
=== <nowiki>*ngStyle</nowiki> ===
 
<syntaxhighlight lang="html">
<div [style.background-color]="'yellow'">Testing</div>
<div [style.background-color]="'yellow'">Testing</div>


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


== Miscellaneous ==
== Miscellaneous ==

Navigation menu