Hacker News new | ask | show | jobs
by liberte9 4803 days ago
I'm not sure I agree with the idea of adding utility methods to the $rootScope to avoid wiring in dependencies repeatedly. I would probably go with defining a utility class and indeed injecting it into every controller that needs it. I like the idea of having my utility methods clearly defined in one place. Any opinions here on the pros/cons?
1 comments

I'm for using services to define whatever object used across controllers and other services. Using rootscope or scope inheritance is very tricky in AngularJS
Agreed. Any utility functions should go into a different service.

Using $rootScope feels like a hack.