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.

1

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.