Модуль «angular2 / angular2» не имеет экспортируемого элемента «For»
Я следую инструкциям на официальном сайте Angular2.
https://angular.io/docs/js/latest/guide/displaying-data.html
Вот мой файл .ts:
/// <reference path="typings/angular2/angular2.d.ts" />
import {Component, View, bootstrap, For} from 'angular2/angular2';
@Component({
selector: 'display'
})
@View({
template: '<p>name: {{myName}}</p>' +
'<p>Friends:</p>' +
'<ul>'+
'<li *for="#name of names">'+
'{{name}}'+
'<li>'+
'<ul>',
directives: [For]
})
class DisplayComponent{
myName: string;
names: Array<string>;
constructotr(){
this.myName = "Alice";
this.names = ["Winston", "Alex", "Shannon", "Irizu"];
}
}
bootstrap(DisplayComponent);
Вот мой HTML:
<html>
<head>
<script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script>
<script src="https://jspm.io/system@0.16.js"></script>
<script src="https://code.angularjs.org/2.0.0-alpha.23/angular2.dev.js"></script>
</head>
<body>
<display></display>
<script>
System.import('show-properties');
</script>
</body>
</html>
И я установил angular2, Rx и es6-обещание.
Тем не менее ошибка сохраняется.
сообщение TS6042: компиляция завершена. Наблюдаю за изменениями файлов. сообщение TS6032: Обнаружено изменение файла. Запуск инкрементной компиляции ... show-properties.ts (2,37): ошибка TS2305: Модуль "angular2 / angular2" не имеет ожидаемого элемента "For". сообщение TS6042: компиляция завершена. Наблюдаю за изменениями файлов.
Обновить
Вот мой обновленный код .ts:
/// <reference path="typings/angular2/angular2.d.ts" />
import {
ComponentAnnotation as Component,
ViewAnnotation as View, bootstrap, NgFor
} from 'angular2/angular2';
@Component({
selector: 'display'
})
@View({
template: '<p>name: {{myName}}</p>' +
'<p>Friends:</p>' +
'<ul>'+
'<li *ng-for="#name of names">'+
'{{name}}'+
'<li>'+
'<ul>',
directives: [NgFor]
})
class DisplayComponent{
myName: string;
names: Array<string>;
constructotr(){
this.myName = "Alice";
this.names = ["Winston", "Alex", "Shannon", "Irizu"];
}
}
bootstrap(DisplayComponent);
angular2.d.ts по-прежнему альфа 26.
Теперь нет сообщения об ошибке, и я вижу
имя: друзья:
Но никакие значения не вставляются. И у меня есть сообщение об ошибке:
show-properties.ts (7,2): ошибка TS2348: значение типа 'typeof ComponentAnnotation' не вызывается. Вы хотели включить «новый»? show-properties.ts (10,2): ошибка TS2348: значение типа typeAnnotation не вызывается. Вы хотели включить «новый»? сообщение TS6042: компиляция завершена. Наблюдаю за изменениями файлов.