如何使用陣列語法建立具有依賴項的服務
angular.module("app")
.service("counterService", ["fooService", "barService", function(anotherService, barService){
var service = {
number: 0,
foo: function () {
return fooService.bazMethod(); // Use of 'fooService'
},
bar: function () {
return barService.bazMethod(); // Use of 'barService'
}
};
return service;
}]);