Angular没有NameService提供程序
我在将类加载到Angular组件时遇到问题。我已经尝试解决很长时间了;我什至尝试将它们全部合并到一个文件中。我所拥有的是: 应用程序 /// <reference path="../typings/angular2/angular2.d.ts" /> import {Component,View,bootstrap,NgFor} from "angular2/angular2"; import {NameService} from "./services/NameService"; @Component({ selector:'my-app', injectables: [NameService] }) @View({ template:'<h1>Hi {{name}}</h1>' + '<p>Friends</p>' + '<ul>' + ' <li *ng-for="#name of names">{{name}}</li>' + '</ul>', directives:[NgFor] }) class MyAppComponent { name:string; names:Array<string>; constructor(nameService:NameService) { this.name = 'Michal'; this.names = nameService.getNames(); } …