Angular 2: Difference between revisions

Jump to navigation Jump to search
634 bytes added ,  11 April 2016
add built-in components
add directives
add built-in components
Line 1: Line 1:
== Built-in Components ==
=== <nowiki>*ngIf</nowiki> ===
<syntaxhighlight lang="html">
<div *ngIf="false"></div>
<div *ngIf="a > b"></div>
<div *ngIf="str == 'yes'"></div>
<div *ngIf="myFunc()"></div>
</syntaxhighlight>
=== <nowiki>*ngSwitch</nowiki> ===
<div class="container" [ngSwitch]="myVar">
  <div *ngSwitchWhen="'A'">Var is A</div>
  <div *ngSwitchWhen="'B'">Var is B</div>
  <div *ngSwitchDefault>Var is something else</div>
</div>
=== <nowiki>*ngStyle</nowiki> ===
<div [style.background-color]="'yellow'">Testing</div>
<div [ngStyle]="{color: 'white', 'background-color': 'blue'}">testing</div>
== Miscellaneous ==


Four basic libraries to include
Four basic libraries to include

Navigation menu