mikemclin / angular-acl

Role-based permissions for AngularJS
196 stars 49 forks source link

Protect a route #19

Closed brunoneve closed 8 years ago

brunoneve commented 8 years ago

Hi Guys,

in the readme has example to protect a route, I tried and not funcinou, so I made some changes and is now working.

will example if someone needs, using $ routeChangeError

    $rootScope.$on('$routeChangeError', function(event, current, previous, rejection){
        console.log(rejection);
        if(rejection === 'Unauthorized'){
            $location.path('home');
        }
    });

Att.

mikemclin commented 8 years ago

Thanks. I've updated the README example, adding the event param as the first param in the $routeChangeError callback function.