Let's say we have the following service:
myApp.factory('FooService', function () { ...
Then, from a controller, I would say:
myApp.controller('FooCtrl', ['$scope', 'FooService', function ($scope, FooService) { ...
The two-part question is:
- Global Accessibility: If I have 100 controllers and all need access to the service, I don't want to explicitly inject it 100 times. How can I make the service globally available? Only thing I can think of at the moment is wrapping it from within the root scope, which defeats the purpose.
- Accessibility from view: How can I access the service from within the view? This post suggests wrapping the service from within the controller. If I am going to that length, seems I ought to just implement the functionality right on the root scope?