Show progress circular during $http post?

后端 未结 7 1006
名媛妹妹
名媛妹妹 2021-02-08 16:05

What is the best way to use Angular Material\'s Progress circular component with a $http request?

I currently have the code like this below:

Progre

7条回答
  •  有刺的猬
    2021-02-08 16:38

    First set some model:

    $scope.loading=false;
    

    Bind that model with progress circular element ng-show property:

    
    

    Set it to true before calling $http request and set it to false on $http .success:

    $scope.loading=true;
    
    $http.get("/posts")
       .success(function (data) {
    
          $scope.posts = data;
    
          $scope.loading=false;
    
       })
    

    Hope that helps.

提交回复
热议问题