diff options
Diffstat (limited to 'js/config/run.js')
-rw-r--r-- | js/config/run.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/js/config/run.js b/js/config/run.js index 3feca64e4..1c87228fe 100644 --- a/js/config/run.js +++ b/js/config/run.js @@ -7,8 +7,19 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2012, 2014 */ -app.run(function ($rootScope) { +app.run(function ($rootScope, $location, Loading) { 'use strict'; - $rootScope.$on('$routeChangeError'); + $rootScope.$on('$routeChangeStart', function () { + Loading.isActive = true; + }); + + $rootScope.$on('$routeChangeSuccess', function () { + Loading.isActive = false; + }); + + // in case of wrong id etc show all items + $rootScope.$on('$routeChangeError', function () { + $location.path('/items'); + }); });
\ No newline at end of file |