Changed For and If directive to NgFor and NgIf in the user-input section

This commit is contained in:
Sam Verschueren 2015-06-04 12:43:58 +02:00 committed by Naomi Black
parent d61e884e08
commit 0d04f161aa
1 changed files with 7 additions and 7 deletions

View File

@ -66,12 +66,12 @@
.l-main-section
h2#section-display-the-list-of-todos Display the list of todos
p.
Using the <code>*for</code> iterator, create an <code>&lt;li&gt;</code> for each item in the todos array and set
Using the <code>*ng-for</code> iterator, create an <code>&lt;li&gt;</code> for each item in the todos array and set
its text to the value.
code-example(language="html" format="linenums").
&lt;ul&gt;
&lt;li *for=&quot;#todo of todos&quot;&gt;
&lt;li *ng-for=&quot;#todo of todos&quot;&gt;
{{ todo }}
&lt;/li&gt;
&lt;/ul&gt;
@ -107,7 +107,7 @@
code-tabs
code-pane(language="javascript" name="TypeScript" format="linenums").
//TypeScript
import {Component, View, bootstrap, For, If} from 'angular2/angular2';
import {Component, View, bootstrap, NgFor, NgIf} from 'angular2/angular2';
@Component({
selector: 'todo-list'
@ -115,7 +115,7 @@
@View({
template: `
&lt;ul&gt;
&lt;li *for="#todo of todos"&gt;
&lt;li *ngfor="#todo of todos"&gt;
{{ todo }}
&lt;/li&gt;
&lt;/ul&gt;
@ -123,7 +123,7 @@
&lt;input #todotext (keyup)="doneTyping($event)"&gt;
&lt;button (click)="addTodo(todotext.value)"&gt;Add Todo&lt;/button&gt;
`,
directives: [For, If]
directives: [NgFor, NIf]
})
class TodoList {
todos: Array&lt;string&gt;;
@ -169,13 +169,13 @@
new angular.ViewAnnotation({
template:
'&lt;ul&gt;' +
'&lt;li *for="#todo of todos">' +
'&lt;li *ng-for="#todo of todos">' +
'{{ todo }}' +
'&lt;/li&gt;' +
'&lt;/ul&gt;' +
'&lt;input #textbox (keyup)="doneTyping($event)">' +
'&lt;button (click)="addTodo(textbox.value)"&gt;Add Todo&lt;/button&gt;',
directives: [angular.For, angular.If]
directives: [angular.NgFor, angular.NgIf]
})
];