2017-03-18 3 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; 
}); 
}; 
관련 문제