Created
October 9, 2016 11:02
-
-
Save irokhes/38cb6a7725a487bd4d323d2a6a232afd to your computer and use it in GitHub Desktop.
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
app.config(function($routeProvider){ | |
$routeProvider | |
.when('/secretpage' ,{ | |
templateUrl: "templates/secretpage.html", | |
resolve:{ | |
"check":function(authService,$location){ //function to be resolved, accessFac and $location Injected | |
if(authService.isAuthenticated()){ //This happens before the page loads | |
//it's ok to see the content | |
}else{ | |
$location.path('/'); //redirect user to home if it does not have permission. | |
alert("You don't have access here"); | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment