Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <button ng-click="transferState($state.current.name)">Click me</button>
- .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,
- // <li ng-class="{ active: $state.includes('contacts.list') }"> will set the <li>
- // to active whenever 'contacts.list' or one of its decendents is active.
- $rootScope.$state = $state;
- $rootScope.$stateParams = $stateParams;
- }])
- angular.module('myApp').controller('myCtrl', function($scope, $state) {
- $scope.$state = $state;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement