【发布时间】:2017-06-22 12:57:28
【问题描述】:
$http({
method: 'POST',
url: '',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
transformRequest: function(obj) {
var str = [];
for(var p in obj)
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
return str.join("&");
},
data: {
}
}).then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
if(response.data == 'true'){
swal("Good job!", "New case has been created", "success");
}
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
我想在 angularjs 上的 http 请求时显示进度条或在 bootstrap 上旋转
【问题讨论】:
-
您可以添加一个加载 div 或 img,然后在其上放置一个
ng-if属性,在您开始请求之前将一些showLoader变量在您的$scope中设置为true,然后然后在成功或错误时设置为false。 -
我的回答有帮助吗?
-
是的,它很有帮助,非常感谢
-
@Aravind 你能回答我的另一个问题吗? stackoverflow.com/questions/42532079/…谢谢大佬的支持
-
@ShabeebCk 你已经有答案了!你还想要我的解决方案吗?
标签: angularjs twitter-bootstrap