0
我試圖顯示一個加載器($ ionicLoading)時點擊一個鏈接,但它不顯示。ionicLoading loader does not show
HTML:
ion-slide-box show-pager="true" does-continue="false" on-slide-changed="slideHasChanged($index)">
<ion-slide ng-repeat="s in sliderPages">
<ul>
<li ng-repeat="item in suggestionList | limitTo:s*sliderItemNumber+sliderItemNumber:s*sliderItemNumber ">
<a class="suggestPro" ng-click="sleep(200);launchComputeService(item.id)">
<span><img ng-src={{imagesUrls[item.imageName]}} /></span>
<p class="flex-caption"> {{item.model}} - {{item.name}}</p>
</a>
</li>
</ul>
</ion-slide>
</ion-slide-box>
controllers.js:
$scope.sleep = function(milliseconds) {
console.log("on passe dans sleep")
$ionicLoading.show({
template: 'Loading...'
});
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){
$ionicLoading.hide();
break;
}
}
}