What are some examples of when to utilize the angular.run
method? I have a service that is resource-intensive and takes a significant amount of time to initialize before it can be used in conjunction with my view.
angular.module('myApp').service('heavyService',function($timeout){
this.someAjaxCall=function(){
}
});
angular.module('myApp').run(function(heavyService){
// How can I incorporate my heavyService here and then later use it throughout the application
});
How can you inject a service
within the run
method and subsequently utilize it within the application
?