Hi Sander,
there is no use case which demands a global handler absolutley. But it
would be very convenient.
With "inject the service in every component" I meant the main component of
a certain domain (e.g. for a user profile page). And of course not the many
"components which are used to assemble such a main component.
(when this is what you mean with tree like structure)
But the point is, I have no user data or user data when the user is
authenticated. The user data maybe contain certain userrights. Based on the
state authenticated or not, user has userright or not I want to decide...
Of course, I can inject the service which holds the user data and the
decision logic in every "main" component (which needs such a decision) and
call the the service (e.g. userService.isAllowed('componentName').
But I would really prefer the "global handler" way...
Regards
Martin
Am Dienstag, 22. Dezember 2015 15:56:17 UTC+1 schrieb Sander Elias:
>
> Hi Martin,
>
> No, you shouldn't need to inject it everywhere. Usually there is no need
> for that. If you make sure that at a higher-level component the check is
> done.
> See, for the router your app has a tree-like structure. You can put an
> can(de)activate on every branch, and/or even at the base. everything above
> that point, can only be reached when the condition is satisfied.
>
> Can you provide a use-case that really demands a global handler?
>
> Regards
> Sander
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.