1

I am playing around with ui-router for AngularJS and was wondering if anyone out there could point me in the direction of securing routes based on authorization roles.

I have looked at the resolve object on the state, but it seems like I am looking in the wrong place.

Sam
  • 15,336
  • 25
  • 85
  • 148
  • Take a look at http://stackoverflow.com/questions/22537311/angular-ui-router-login-authentication/22540482#comment37988970_22540482 – Sebastian Jul 11 '14 at 08:46

1 Answers1

2

Have a look at $urlRouterProvider.when() here: https://github.com/angular-ui/ui-router/wiki/URL-Routing#urlrouterprovider

If you pass in a function (instead of a redirecting url), it is injectable. So if you inject a service that you use to manage authentication, you can redirect the user as per your requirements.

Matt Way
  • 32,319
  • 10
  • 79
  • 85