.factory('user',['$http',function($http){
return {
getUser:function(){
return $http({
method: 'GET',
url:baseApi + '/api/user',
cache:true
})
},
getAddressList:function(){
user.getUser().then(function(res){
var userId = res.data.id;
console.log(res)
return $http({
method: 'GET',
url:baseApi+'/api/user/address/getuseraddress',
params:{
user_id: userId
}
})
})
}
}
}])
上面代码中的getAddressList方法依赖getUser方法返回的数据,该怎么修改?
相关分类