0
votes

I am using Angular UI router with Ionic. I want to redirect page from one to another within a function.

I have default menu in all pages.

enter image description here

I tried used $state.go. but $state.go is changing the whole url and creating a back button.

enter image description here

I want my menu still be there in my page.

Here is my code: controller.js:

$scope.changeState = function () {
    $state.go('app.registration');
  };

app.js

app.config(function($stateProvider, $urlRouterProvider) {
  $stateProvider

    .state('app', {
    url: '/app',
    abstract: true,
    templateUrl: 'templates/menu.html',
    controller: 'AppCtrl'
  })
    .state('app.login', {
      url: '/login',
      views: {
        'menuContent': {
          templateUrl: 'templates/login.html',
          controller: 'signinController'
        }
      }
    }) 
    .state('app.registration', {
      url: '/registration',
      views: {
        'menuContent': {
          templateUrl: 'templates/registration.html',
          controller: 'signupController'
        }
      }
    }) 

})

Finally what i want is, I want to redirect the page inside a function call, and my menu should be there. i dont want default back button.

Please help me to do this.

Thanks, Priya.

1
what is the state config for /dashboard? - sdfacre
now i am roughly using app.registration. - Priya Rajaram
add in your css for hide default back button .back-button{display:none;} - Ved

1 Answers

1
votes
  1. For menu to be there, your Dashboard has to be a child of Main view. app.login means login is a child view of app.
  2. Back button appears because your login view is still in history. You have to clear history before view change on successful login. $ionicHistory will help.