You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Hello!
I recently tried to find a way of restricting access to some of my routes only to users who are logged in. In doing so I am attaching a custom property to each of my routes which indicates what access level it has. Furthermore, I have a $routeChangeStart handler which inspects this value through nextRoute.$$route, and then performs some logic to admit or forbid access. You can see a full example at fnakstad/angular-client-side-auth.
However, I discovered through issue #1907 that there are plans to remove this property completely, which would render my solution useless. So, I'm wondering if there are any other ways to associate your own metadata with a route and then read it out in the $routeChangeStart handler? Or any plans to implement that kind of functionality?
The text was updated successfully, but these errors were encountered:
Hey and thanks for the input,
I'm aware that I can get most route information I need by simply looking at next, but any custom properties I might attach to my routes will be stripped away. Here's an example...
Here I create a route where I have a custom property access associated with the route. However, while I am able to retrieve this custom property from next.$$route, it seems to be stripped away from the plain next property.
I've been looking at the documentation, and there doesn't seem to be a way of retrieving custom properties you set on your routes. I thought this issue went beyond simply how Angular works as of today, which is why I posted it here.
Do not know what to tell you without doing a closer look at your code, but I am sure that next has all the custom properties as I use this extensively in the form of
Hello!
I recently tried to find a way of restricting access to some of my routes only to users who are logged in. In doing so I am attaching a custom property to each of my routes which indicates what access level it has. Furthermore, I have a
$routeChangeStart
handler which inspects this value throughnextRoute.$$route
, and then performs some logic to admit or forbid access. You can see a full example at fnakstad/angular-client-side-auth.However, I discovered through issue #1907 that there are plans to remove this property completely, which would render my solution useless. So, I'm wondering if there are any other ways to associate your own metadata with a route and then read it out in the
$routeChangeStart
handler? Or any plans to implement that kind of functionality?The text was updated successfully, but these errors were encountered: