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