Reputation: 3922
If I wanted to implement a function/object which represented a higher level of control in the AngularJS world, i.e. NOT reactive control to events (which are aptly handled by AngularJS 'controllers'), what is the best way to implement this in AngularJS?
Would it be a service?
Typical functions might include:
--AngularJS-Architect-in-Training
Upvotes: 0
Views: 1179
Reputation: 8948
Yes.. these are all examples of what you'll do inside of services.
Later you just inject them to controllers and use $scope.$watch to listen to changes they hold, or subscribe to events, whichever method you prefer...
For bootstrapping you can use -
angular.module("myApp, []).run(function(..deps..){ ..run content.. })
Upvotes: 3