Hi,

thank you both for you opinions. Thanks to Sanders, I see now, that the 
global event isn't absolutly neccessary, but I also feel like Martin.

We are talking about cross-cutting-concerns here. Devs see for years, that 
it isn't the best idea, to put such concerns into every piece of code. 
That's why, we have concepts, like interceptors or global events. In the 
mentioned sample, we could use such concepts to implement a good default 
behavior for all components, that have not been annotated.

Wishes,
Manfred

Am Mittwoch, 23. Dezember 2015 07:37:27 UTC+1 schrieb Martin Kuhn:
>
> 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 angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to