// Make sure to include the `ui.router` module as a dependency angular.module('uiRouterSample', ['ui.router']) .run( [ '$rootScope', '$state', '$stateParams', function ($rootScope, $state, $stateParams) { // It's very handy to add references to $state and $stateParams to the $rootScope // so that you can access them from any scope within your applications.For example, //
  • will set the
  • // to active whenever 'contacts.list' or one of its decendents is active. $rootScope.$state = $state; $rootScope.$stateParams = $stateParams; }]);