I use <div ng-view></div>
on web page.
When I click link in block <div>
is loaded HTML template was set in routeProvider
. Also together is done request AJAX that returns data that was loaded template.
Now problem is that after click I get HTML template with empty form, still is working AJAX request. After some seconds form HTML is fiiled data from AJAX.
How I can do preloader to page for directory ng-view
?
It seems that there are some similar questions here:
Also, there a bunch of modules to work with loading animation at http://ngmodules.org. For example, these:
UPD: I've written a simple solution based on how the angular-loading-bar works. I didn't test it with ng-view, but it seams to work with ui-view. It is not a final solution and have to be polished.
It can be used like this:
You can try something like this(simplest solution):
Set your loader animation/picture:
<div class="loader" ng-show="isLoading"></div>
On
div
element add click event:isLoading=true
Download javascript and css files from PACE Loader. Playing around with pace loader using ng-views . Hope this helps someone trying to use PACE.JS with Angular. In this example I am using ng-router to navigate between views.
app.js
animateApp.service('slowDataService', SlowDataService);
index.html
default.html
route1.html