template中的内容可以自己更改,不要忘了注入参数。
$httpProvider.interceptors.push(function ($rootScope, $injector) {
return {
request: function (config) {
if (config.url.toString().indexOf('http://') === 0) {
$injector.get('$ionicLoading').show({
template: '<div><svg class="circular"><circle r="20" class="path" cx="50" cy="50" fill="none" stroke-width="2" stroke-miterlimit="10"></circle></svg>'
});
}
return config;
},
response: function (response) {
if (response.config.url.indexOf(' === 0')) {
$injector.get('$ionicLoading').hide();
}
return response;
}
}
$httpProvider.interceptors.push(function ($rootScope, $injector) {
return {
request: function (config) {
if (config.url.toString().indexOf('http://') === 0) {
$injector.get('$ionicLoading').show({
template: '<div><svg class="circular"><circle r="20" class="path" cx="50" cy="50" fill="none" stroke-width="2" stroke-miterlimit="10"></circle></svg>'
});
}
return config;
},
response: function (response) {
if (response.config.url.indexOf(' === 0')) {
$injector.get('$ionicLoading').hide();
}
return response;
}
}
});