El módulo '"angular2 / angular2"' no tiene ningún miembro exportado 'Para'
Estoy siguiendo el tutorial en el sitio web oficial de Angular2.
https://angular.io/docs/js/latest/guide/displaying-data.html
Aquí está mi archivo .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);
Aquí está mi html:
<html>
<head>
<script src="https://github.jspm.io/jmcriffey/[email protected]/traceur-runtime.js"></script>
<script src="https://jspm.io/[email protected]"></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>
Y he instalado angular2, Rx y es6-promise.
Aún persiste el error.
mensaje TS6042: Compilación completa. Observando los cambios de archivo. mensaje TS6032: cambio de archivo detectado. Iniciando la compilación incremental ... show-properties.ts (2,37): error TS2305: El módulo '"angular2 / angular2"' no tiene un miembro expuesto 'For'. mensaje TS6042: Compilación completa. Observando los cambios de archivo.
Actualizar
Aquí está mi código .ts actualizado:
/// <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 sigue siendo alfa 26.
Ahora no hay ningún mensaje de error y puedo ver
nombre: amigos:
Pero no se insertan valores. Y tengo un mensaje de error:
show-properties.ts (7,2): error TS2348: El valor del tipo 'typeof ComponentAnnotation' no es invocable. ¿Querías incluir 'nuevo'? show-properties.ts (10,2): error TS2348: El valor del tipo 'typeof ViewAnnotation' no es invocable. ¿Querías incluir 'nuevo'? mensaje TS6042: Compilación completa. Observando los cambios de archivo.