Hide page content while loading data


#1

I need to hide page content until all data is loaded. First, I wanted to stretch loader but I found it

hard since I don’t want to hide header and tab headers.

I ended up with <ion-content ng-show="dataLoaded === true"> which works great.

In controller:

$ionicLoading.show();
dataLoaded = false;
$ionicLoading.hide();
dataLoaded = true;

1/ What do you think about this approach?
2/ Is there any method like $ionicLoading.isLoading() so that I don’t need to cotrol it manually using
dataLoaded = true/false?


#2

wrap your content in a div and use ng-if="dataLoaded" to show messages of loading or the content itself.


#3

That’s basically what I did (didn’t wrap it, used ion-content), but it doesn’t solve the problem that I need to manually set dataLoaded property :frowning: