4,500
edits
Line 1: | Line 1: | ||
= ngFor to iterate through an array = | = Basics = | ||
== Using variable == | |||
<syntaxhighlight lang="ts"> | |||
import { Component } from '@angular/core'; | |||
@Component({ | |||
selector: 'my-app', | |||
template: ` | |||
<div>Hello {{ name }}</div> | |||
` | |||
}) | |||
export class AppComponent { | |||
name: string; | |||
constructor() { | |||
this.name = 'Michael'; | |||
} | |||
} | |||
</syntaxhighlight> | |||
<div class="mw-geshi">Hello Michael</div> | |||
== ngFor to iterate through an array == | |||
<syntaxhighlight lang="ts"> | <syntaxhighlight lang="ts"> | ||
Line 22: | Line 47: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
< | <div class="mw-geshi"> | ||
* Hello Ari | |||
* Hello Carlos | |||
</ | * Hello Felipe | ||
* Hello Nate | |||
</div> |