Reputation: 55759
When bootstrapping an AngularJS app is it possible to configure the root scope object before any directive in the application is instantiated?
I want to supply an object an make it available to the application via the root scope (or even the injector).
var myObject = { /* stuff */ };
// Can I make `myObject` available to the application via AngularJS?
angular.bootstrap(rootDomNode, [APPLICATION_NAME]);
Or should I bypass AngularJS for this and stick it in some shared object?
Upvotes: 0
Views: 29
Reputation: 388
You can use the module's .run() function to do that:
angular.module('myModule', []).
.run(function($rootscope) { // instance-injector
// Modify your rootscope here
});
Upvotes: 3