让我说我的代码如下
var app = angular.module("myApp", []);
app.controller("Customerfactory", Customerfactory);
app.service("Address",Address);
app.service("Phone",Phone);
app.service("customer",customer);
app.service('CreateFactory',CreateFactory);
我想将Address
和Phone
服务注入customer
服务,然后使用数组注入技术将customer
服务注入createFactory
服务。
任何想法。
答案 0 :(得分:2)
试试这个
app.service("customer",['Address','Phone',function(Address,Phone){
}]);
app.service('CreateFactory',['customer',function(customer){
}]);
答案 1 :(得分:0)
您只需在Angular中使用常规注入规则(遵循约定即可缩小代码):
app.service('service2',['service1', function(service1) {}]);
答案 2 :(得分:0)
我没有使用任何方括号来表示Angular,更少的错误
app.service("customer", function(Address, Phone){
});
app.service('CreateFactory', function(customer){
});