angular.module('app', [
... ])
.constant('AppConstants', constants)
.config(appConfig)
.run((UserService, User) => {
'ngInject';
console.log('apprun')
UserService.acl()
.then((data) => {
console.log('data')
User.setACL(data)
console.log(data)//finsish this first then go to second run call
})
.catch((err) => {
console.log(err);
})
})
.run(appRun)
.component('app', AppComponent)
我需要首先完成Usercervice.acl
调用,然后运行第二次运行(apprun)方法需要在这里调用来自UserService.acl()
的代码
让acl =()=> {
return $ http.get(AppConstants.api + /acl/user-resources
)
.then((res)=> {
返回res.data
})
}
答案 0 :(得分:0)
.constant('AppConstants', constants)
.config(appConfig)
.run((UserService, User) => {
'ngInject';
console.log('apprun')
UserService.acl()
.then((data) => {
console.log('data')
User.setACL(data)
console.log("done with first run")//finsish this first then go to second run call
/*here is my second run block i.e. on success of first one*/
var acl = () => {
return $http .get(AppConstants.api + /acl/user-resources).then((res) {
return res.data
})
}
})
.catch((err) => {
console.log(err);
})
})
.run(appRun)
.component('app', AppComponent)