my code :
app.factory('requestData',function($http,$q){
return {
reqData:function(params,url){
return $http.get(url,{"params":params}).then(function(data){
return data.data
});
});
requestData.reqData( {module:"channel"},'/channel' ).then(function(data){
$scope.selectChannel = data.value;
})
.then(function(){
requestData.reqData( {channel_id:$scope.selectChannel},'/channel').then(function(data){
$scope.summary = data.summary;
})
})
.then(function(){
//use $scope.summary do something
});
firstly,i must set "$scope.selectChannel" value by asynchronous,then i use "$scope.selectChannel" to request. there is another method to achieve?