标签:
对于 $http
对于参数
$http({
url:myUrl,
method:‘GET‘,
params:myParams,
paramSerializer:‘$httpParamSerializerJQLink‘
})
// 或者
.controller(function($http,$httpParamSerializerJQLike){
$http({
url:myUrl,
method:‘GET‘,
data:$httpParamSerializerJQLike(myData),
headers:{
‘Content-Type‘:‘xxxx‘
}
})
})
对于返回结果
$http({
}).then(function(){},function(){})
如果所有的走$http 服务的话,提供一个全局的拦截机制。
.config($httpProvider){
$httpProvider.omterceptors.push(function(){
return {
request:function(config){
},
requestError:function(rejection){
},
response:function(response){
},
responseError:function(rejection){
}
}
})
}
标签:
原文地址:http://my.oschina.net/bosscheng/blog/517463