AngularJS - How do I change the State from Inside the Controller AngularJS - How do I change the State from Inside the Controller angularjs angularjs

AngularJS - How do I change the State from Inside the Controller


inject $state service to your controller, then in your controller...

CONTROLLER

$scope.changeState = function () {    $state.go('where.ever.you.want.to.go', {stateParamKey: exampleParam});};

and add ng-click to your button

HTML

<button ng-click="changeState()">Change State</button>