Angular2 uses Route guard To control whether the user can navigate to or away from a given route,so if unauthorised user try to access a path route guard will protect.
Is there any alternate way for route guard in polymer 1.0? if not how it can be implemented?
I don't know of any existing implementation, though it's always a good idea to search http://webcomponents.org, since one might pop up there any second.
To implement this yourself, start by creating some kind of rights management behavior (or mixin class in Polymer 2) (which might query a web service for a map of
{right1: Array<User>, ...}
; but don't forget about caching and so on...) which has a methodcheckRight(rightName, user)
. You can then mix in that behavior/class to consuming elements, and bind the methodcheckRight
to any element you want to guard, for example an iron-pages' child'shidden
-attribute: