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