// 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, //