在 $http 帖子中显示进度通知? [英] Show progress circular during $http post?
本文介绍了在 $http 帖子中显示进度通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 Angular Material 的进度循环的最佳方式是什么 带有 $http
请求的组件?
What is the best way to use Angular Material's Progress circular component with a $http
request?
我目前有如下代码:
进度通知:
<md-progress-circular ng-if="determinateValue === 100" md-mode="determinate" value="{{determinateValue}}"></md-progress-circular>
$http
请求:
$scope.determinateValue = 0;
$http.get("/posts")
.success(function (data) {
$scope.posts = data;
$scope.determinateValue = 100;
})
推荐答案
我认为您不需要 value
属性和 determinate
模式.相反,您应该使用 indeterminate
模式,然后使用 ngShow
显示和隐藏进度指示器.
I don't think you need the value
attribute here with determinate
mode. Instead you should use indeterminate
mode, then show and hide the progress indicator using ngShow
.
<md-progress-circular md-mode="indeterminate" ng-show="isLoading"></md-progress-circular>
在你的 JS 中
$scope.isLoading = true;
$http.get("/posts")
.success(function (data) {
$scope.isLoading = false;
});
这篇关于在 $http 帖子中显示进度通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文