2017-03-18 13 views
0

ビデオをアップロードするときに進行状況バーを使用しようとしていますが、進行状況バーがページをロードして永遠に表示されます。角材料円形進行状況バーの使用方法

<div ng-show="!$ctrl.setNewVideoRecord()"> 
    <md-progress-circular md-mode="indeterminate" md-diameter="100"> 
    </md-progress-circular> 
</div> 

<md-button class="md-raised md-primary" ng-click="$ctrl.setNewVideoRecord()"> Add video</md-button> 

self.setNewVideoRecord = function() { 
adminService.setNewVideoRecord(self.fileForUpload) 
    .then(function() { 
}); 
}; 

答えて

1

最も良い方法は、スコープ変数を適用することです。関数内でスコープ変数の値をそれに応じて設定します。現在、ng-showを適用する関数を呼び出していますが、その関数は、プログレスバーを表示するためにtrueまたはfalseを返す必要があります。最善の方法は次のとおりです。

<div ng-show="$ctrl.videoUploading"> 
    <md-progress-circular md-mode="indeterminate" md-diameter="100"> 
    </md-progress-circular> 
</div> 


<md-button class="md-raised md-primary" ng-click="$ctrl.setNewVideoRecord()"> Add video</md-button> 

self.videoUploading = false; 
self.setNewVideoRecord = function() { 
    self.videoUploading = true; 
    adminService.setNewVideoRecord(self.fileForUpload) 
    .then(function() { 
    // your code here, and when the video uploading is completed again set the variable false 
     self.videoUploading = false; 
}); 
}; 
関連する問題