Skip to content Skip to sidebar Skip to footer

$state.go Not Working With Angularjs 1.5

I want configure the routing at my app angularjs this is my app.js In my app.js I have two chlidren login and home bu default I have loginComponent and then when I click on button

Solution 1:

As mentioned in a comment, you need to inject $state into LoginController.

classLoginController {
  constructor($state) {
    this.name = 'login';
    this.$state = $state;
    console.log('login controller');
  }
  openHome(){
    console.log("uo");
    this.$state.go('home');
  }
}

LoginController.$inject = ['$state'];

exportdefaultLoginController;

Or you can use something like ng-annotate

Post a Comment for "$state.go Not Working With Angularjs 1.5"