Here is how I did it.
app.js
(function(){ angular.module('app',[]); })();
SomeService.js
(function(){ angular.module('app'); .factory('someService',function(){ return { doSomething: function(){ $('.container-fluid').css('display', 'none'); } }; }); })();
app.run.js
(function(){ angular.module('app') //Inject your service here .run(function($rootScope,someService){ //Look for successful state change. //For your ref. on other events. //https://github.com/angular-ui/ui-router/wiki
Always wrap your angular code in IIFE , it completes everything in closure and prevents leaks, and also provides a level of security.
Hope this helps!
source share