Last active
November 13, 2015 13:52
-
-
Save matiasfha/ac24c76a426285184b5b to your computer and use it in GitHub Desktop.
Route loader directive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function routeLoaderCtrl ($rootScope) { | |
| $rootScope.$on('$routeChangeStart', function (){ | |
| this.routeLoading = true; | |
| }.bind(this)); | |
| $rootScope.$on('$routeChangeSuccess', function (){ | |
| this.routeLoading = false; | |
| }.bind(this)); | |
| } | |
| function routeLoaderDirective () { | |
| return { | |
| restrict: 'E', | |
| templateUrl: 'route-loader.html', | |
| controller: 'routeLoaderCtrl', | |
| controllerAs: 'vm', | |
| scope: {}, | |
| bindToController: { | |
| routeLoading:'=' | |
| } | |
| } | |
| } | |
| angular | |
| .module('core') | |
| .controller('routeLoaderCtrl', routeLoaderCtrl) | |
| .directive('routeLoader',routeLoaderDirective); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment