0

I am maintaining a state as follows

<ui-state id='activeScreen' default='1'></ui-state>

I am able to change the state as follows

<a href="#" ui-set="{'activeScreen': 2}">click here</a>

How to change the state from the controller code?

Dickens A S
  • 3,824
  • 2
  • 22
  • 45

1 Answers1

0

You need to use the SharedState service:

app.controller('myController', function($scope, SharedState){
  SharedState.initialize($scope, "activeScreen", 2);
});

Or:

app.controller('myController', function($scope, SharedState){
  SharedState.set("activeScreen", 2);
});
michelem
  • 14,430
  • 5
  • 50
  • 66