 <p>Here is how I would do.</p> <blockquote> <p>app.js</p> </blockquote> <pre><code>(function(){ angular.module('app',[]); /* other code like configuration etc */ })(); </code></pre> <blockquote> <p>SomeService.js</p> </blockquote> <pre><code>(function(){ angular.module('app'); .factory('someService',function(){ return { doSomething: function(){ $('.container-fluid').css('display', 'none'); } }; }); })(); </code></pre> <blockquote> <p>app.run.js</p> </blockquote> <pre><code>(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#state-change-events $rootScope.$on('$stateChangeSuccess', function() { //If you don't wanna create the service, you can directly write // your function here. someService.doSomething(); }); }) })(); </code></pre> <p>Always wrap your angular code within <a href="https://en.wikipedia.org/wiki/Immediately-invoked_function_expression" rel="nofollow">IIFE</a> it wraps everything in closure and prevents leaks as well as provides a layer of security.</p> <p>Hope this helps!</p>