I have this function, when it is executed, it runs twice. I see alert(ok), then alert(ok)I don’t know why.
$rootScope.$on( "$routeChangeStart", function(event, next, current) {
if ( next.templateUrl == "partials/login.html" ) {
alert( "ok" );
$location.path( "/login" );
}
}
source
share