tesicg tesicg - 3 months ago 22
AngularJS Question

How to display wait message in AngularJS while data loading?

I'm new in AngularJS and trying to find the way how to display wait message while data loading? I mean data starts loading, display message and remove it when data loading is done.

I've searched the internet but haven't found anything I need...

Answer
<div ng-if="data.dataLoading">
    Loading...
</div>

JS

$scope.data.dataLoading = true;

return someService.getData().then(function (results) {                    
    ...
}).finally(function () {
    $scope.data.dataLoading = false;
});