So, I’ve actually found a fairly decent way to customize the loader, although I’ve had to navigate around some of the default CSS in order to keep the loading bar responsive for a few screen sizes.
In terms of customizing the background (along with a header) I’m overriding the loading-backdrop
class. The important part here is setting the width
and margin-left
as percentage sizes, which keeps the loading box looking normal across a few screen sizes.
.loading-backdrop{
margin-top: 44px; /*loading should stay under the header*/
background-color: rgb(237, 240, 241);
}
Then, to style some of the actual loading content, I customize the .loading
class:
.loading{
background-color: inherit;
width: 75% !important;
margin-left: -37.5% !important;
border-width: 2px !important;
border-color: black !important;
border-style: solid !important;
}
Finally, then there’s inserting HTML into the .loading
content, which I did in the $ionicLoading.show()
method, as such:
$scope.loadingIndicator = $ionicLoading.show({
content: "<div class='loading-text'>" +
"<div class='row'> " +
"<div class='col col-33 loading-thumb-container'>" +
"<img class='rec-loading-thumb' src='" + $scope.thumbs.small + "' />" +
"</div> <div class='col col-66'>" +
"<h4 class='black-text'>" + $scope.name + "</h4>" +
"</div> </div>" +
"</div>",
animation: 'fade-in',
showBackdrop: false,
maxWidth: 200,
showDelay: 500
});
The weird part here is that although the $ionicLoading
service calls $compile
on content
, I need to insert some of the view information manually. For now I’m using this workaround, although I think it would be cool if $ionicLoading
could load a template, rather than having me write a bunch of HTML in my controller.
Anyway, thanks for the help, and I hope info about this workaround helps others.