[英]module service is not available injecting service
http://plnkr.co/edit/AmuC4CpfMnP9ySmOI54C?p=preview
var app = angular.module('plunker', ['extraService']);
app.controller('MainCtrl', ['$scope', '$http', 'extraService', function ($scope,$http,extraService) {
$scope.name = 'World';
}]);
app.service('extraService',function(){
return 'abc';
});
我的服務注入有什么問題? 為什么我得到模塊服務extaService不可用錯誤?
聲明模塊時不需要注入服務extraService
采用
var app = angular.module('plunker', []);
代替
var app = angular.module('plunker', ['extraService']);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.