我正在浏览 angular2.0 演示应用程序,但似乎注射剂无法从 build 24 开始工作,并给我错误
“原始错误:无法解析 MyAppComponent 的所有参数。确保它们都有有效的类型或注释。”
直到 build 23 工作正常,请帮我解决
下面的问题是演示代码,我对原始代码做了一些操作,只是为了学习目的
import {Component, View, bootstrap, NgFor} from 'angular2/angular2';
module foo{
class FriendsService {
names: Array<string>;
constructor() {
this.names = ["Alice", "Aarav", "Martín", "Shannon", "Ariana","Kai"];
}
}
@Component({
selector: 'array',
injecetables: [FriendsService]
})
@View({
template: '<p>My name: {{ myName }}</p><p>Friends:</p><ul><li *ng-for="#name of names">{{ name }}</li></ul>',
directives: [NgFor]
})
export class arrayComponent {
myName: string;
names: Array<string>;
constructor(friendsService: FriendsService) {
this.myName = 'Alice';
this.names = friendsService.names;
}
}
}
bootstrap(foo.arrayComponent);