-
Notifications
You must be signed in to change notification settings - Fork 129
Closed
Description
-
Any code that needs to run when an application starts should be declared in a factory, exposed via a function, and injected into the run block.
Why?: Code directly in a run block can be difficult to test. Placing in a factory makes it easier to abstract and mock.
angular .module('app') .run(runBlock); runBlock.$inject = ['authenticator', 'translator']; function runBlock(authenticator, translator) { authenticator.initialize(); translator.initialize(); }