I was going thorugh the angular2.0 demo app but it seems that injectables are not working from build 24 and giving me error as
"ORIGINAL ERROR: Cannot resolve all parameters for MyAppComponent. Make sure they all have valid type or annotations."
till build 23 its working fine ,please help me with the issue
below is the demo code, i had made few manipulations from the original just for learning purpose
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);
The new syntax for
injectables
isappInjector
.Try:
Also, you will want to change your imports for
Component
andView
to: