|
66 | 66 | .l-main-section
|
67 | 67 | h2#section-display-the-list-of-todos Display the list of todos
|
68 | 68 | p.
|
69 |
| - Using the <code>*for</code> iterator, create an <code><li></code> for each item in the todos array and set |
| 69 | + Using the <code>*ng-for</code> iterator, create an <code><li></code> for each item in the todos array and set |
70 | 70 | its text to the value.
|
71 | 71 |
|
72 | 72 | code-example(language="html" format="linenums").
|
73 | 73 | <ul>
|
74 |
| - <li *for="#todo of todos"> |
| 74 | + <li *ng-for="#todo of todos"> |
75 | 75 | {{ todo }}
|
76 | 76 | </li>
|
77 | 77 | </ul>
|
|
107 | 107 | code-tabs
|
108 | 108 | code-pane(language="javascript" name="TypeScript" format="linenums").
|
109 | 109 | //TypeScript
|
110 |
| - import {Component, View, bootstrap, For, If} from 'angular2/angular2'; |
| 110 | + import {Component, View, bootstrap, NgFor, NgIf} from 'angular2/angular2'; |
111 | 111 |
|
112 | 112 | @Component({
|
113 | 113 | selector: 'todo-list'
|
114 | 114 | })
|
115 | 115 | @View({
|
116 | 116 | template: `
|
117 | 117 | <ul>
|
118 |
| - <li *for="#todo of todos"> |
| 118 | + <li *ngfor="#todo of todos"> |
119 | 119 | {{ todo }}
|
120 | 120 | </li>
|
121 | 121 | </ul>
|
122 | 122 |
|
123 | 123 | <input #todotext (keyup)="doneTyping($event)">
|
124 | 124 | <button (click)="addTodo(todotext.value)">Add Todo</button>
|
125 | 125 | `,
|
126 |
| - directives: [For, If] |
| 126 | + directives: [NgFor, NIf] |
127 | 127 | })
|
128 | 128 | class TodoList {
|
129 | 129 | todos: Array<string>;
|
|
169 | 169 | new angular.ViewAnnotation({
|
170 | 170 | template:
|
171 | 171 | '<ul>' +
|
172 |
| - '<li *for="#todo of todos">' + |
| 172 | + '<li *ng-for="#todo of todos">' + |
173 | 173 | '{{ todo }}' +
|
174 | 174 | '</li>' +
|
175 | 175 | '</ul>' +
|
176 | 176 | '<input #textbox (keyup)="doneTyping($event)">' +
|
177 | 177 | '<button (click)="addTodo(textbox.value)">Add Todo</button>',
|
178 |
| - directives: [angular.For, angular.If] |
| 178 | + directives: [angular.NgFor, angular.NgIf] |
179 | 179 | })
|
180 | 180 | ];
|
181 | 181 |
|
|
0 commit comments