0
任何時候我有一個$注入我的服務是失敗的。我似乎無法找到錯誤。如果我註釋掉構造函數中的注入和參數,它可以正常工作。
感謝
module app.common {
export interface IHelloService {
sayHello(text: string): string;
sayGoodbye(text: string): string
}
export class HelloService implements IHelloService {
// lokiInst: Loki;
// idbAdapter: LokiIndexedAdapter;
// usersCollection: LokiCollection<starter.domain.User>;
static $inject = ["$scope"];
constructor(private $scope:ng.IScope) {
}
sayHello(text: string): string {
return "hello" + text;
};
sayGoodbye(text: string): string {
return "goodbye"+ text;
};
}
angular.module("app.common", []);
angular
.module("starter")
.service("helloService",
HelloService);
}