.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方法返回的數據,該怎么修改?
angular 自定義服務里的多個方法,依賴調用
冉冉說
2018-11-16 19:15:43