Custom $ionicLoading template issue


Ionic provides own Loading template (full screen) and I want to create custom one based on $ionicLoading.

So I thought to create my own directive that will take $ionicLoading as template. But found that it will be difficult to maintain.

Regards to DOCs:

{string=} template The html content of the indicator.

So I created some method:

            template: '<div>'+
'<div class="backdrop visible backdrop-loading active wm-proper-times" 
     style="height: 260px;   margin-top: 245px; left: 8;"></div>'+
'<div class="loading visible active" style="margin-left: -53px; margin-top: 76px;background-color: rgba(240, 50, 50, 0.7);"><span>Custom Loading...</span></div>'+
            noBackdrop: true

But I got following result:

As you can see even if I added my custom loading, I still get square on top without text.
How can get rid of this empty square?.

Here is DEMO:


1 Like

I don’t think it’s a bug, but rather the way you’re setting thing things up.

When you call the loader, it will create the markup that you included in your template, so what you were doing was along the lines of a loader inside a loader…woah

So if you wanted to custom the loader, you would just write some css for those divs. The template/templateUrl is more for customizing the content, not the actual loader.

See codepen below.

1 Like

Thank you very much. Great work!

As a side note, I suggest to add to document templateUrl support.

Ideally, IMO, I would have all components (action sheet, popups, loading, etc.) be set up similar to modals. Point to a template html file, have a div with a class of popup, action-sheet, loading, and then throw your content in there.

Hi mhartingon,

How can we use loading.html in a normal application with many templates file in it. Because when I posted loading.html file in my template folder , the application was giving file not found error. So where should we keep loading,html file ?



Hmm is the path relative to the index.html?

I tried a template for my loader and it worked fine for me.

Sorry for hijacking this thread, but is there a way to set ionicLoading template globally rather than for each instance?

you could create a service or directive

How can i make the bottom message i.e “Custom Loading” as dynamic one ?..Is it possible to change the texts ?

Can’t we change the color of spinner inside $ionicLoading?