Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| 56-tools:angular [2018/04/04 02:03] – [Event binding (event)] Roge | 56-tools:angular [2018/04/08 20:48] (Version actuelle) – [*ngFor] Roge | ||
|---|---|---|---|
| Ligne 75: | Ligne 75: | ||
| <!-- phone refers to the input element; pass its `value` to an event handler --> | <!-- phone refers to the input element; pass its `value` to an event handler --> | ||
| <button (click)=" | <button (click)=" | ||
| + | </ | ||
| + | |||
| + | ===== Directives structurelles ===== | ||
| + | |||
| + | ==== *ngIf ==== | ||
| + | |||
| + | Micro syntax: | ||
| + | < | ||
| + | <div *ngIf=" | ||
| + | </ | ||
| + | |||
| + | Equivallent full syntax: | ||
| + | < | ||
| + | < | ||
| + | <div class=" | ||
| + | </ | ||
| + | </ | ||
| + | ==== *ngFor ==== | ||
| + | |||
| + | Micro code: | ||
| + | < | ||
| + | <div *ngFor=" | ||
| + | ({{i}}) {{hero.name}} | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Equivalent full syntax: | ||
| + | < | ||
| + | < | ||
| + | <div [class.odd]=" | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ==== ngSwitch | ||
| + | |||
| + | Micro code: | ||
| + | < | ||
| + | <div [ngSwitch]=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | Equivalent full syntax: | ||
| + | < | ||
| + | <div [ngSwitch]=" | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| </ | </ | ||
| ===== Input and Output properties ===== | ===== Input and Output properties ===== | ||