Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. <button ng-click="transferState($state.current.name)">Click me</button>
  2.  
  3. .run(['$rootScope', '$state', '$stateParams',
  4. function ($rootScope, $state, $stateParams) {
  5.  
  6. // It's very handy to add references to $state and $stateParams to the $rootScope
  7. // so that you can access them from any scope within your applications.For example,
  8. // <li ng-class="{ active: $state.includes('contacts.list') }"> will set the <li>
  9. // to active whenever 'contacts.list' or one of its decendents is active.
  10.  
  11. $rootScope.$state = $state;
  12. $rootScope.$stateParams = $stateParams;
  13. }])
  14.  
  15. angular.module('myApp').controller('myCtrl', function($scope, $state) {
  16.  
  17. $scope.$state = $state;
  18.  
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement