Ionic Modal Transition to any other view


I have created a modal pop up and i have a button on modal to go to next view. How to do it?

<button class="button button-block button-positive" ui-sref="app.main"></button>


It’s not like that. I am developing an Application that has a modal inside a tab and on that modal i have a button and I want to go from that button to a view.

So how should I create state of Modal and navigation?



Can you paste your code into a Plunker?


To display a modal:

  $ionicModal.fromTemplateUrl('templates/login-template.html', {
    scope: $scope,
    animation: 'slide-in-up',  // fade-in, reverse, slide-in-up
    focusFirstInput: true
  }).then(function(modal) {
    $scope.loginModal = modal;

If the modal has a button, you can use ‘ui-sref’:

<button class="button button-outline" ui-sref="app.editor( {postId:} )" translate="EDIT">

or ng-click=“logout()” to call a function in your controller that transitions to a new state via $state.go(‘app.editor’, {postId:});.

To define a state:

  .state('app.main', {
    url: '/main',
    cache: false,
    views: {
      'menuContent': {
        templateUrl: 'templates/main-template.html',
        controller: 'MainController',
        resolve: {
          posts: function(PostsService) {
            return PostsService.findPosts();

For example:



I tried that link in your Ref and the app is flawed:

Click Scientific Facts
Click More Facts
Click Home

Notice there is a Back button on the top-left. Click it.

Now you are back to the More Facts page. This is bad behavior as it will use up too much memory on the device as the user uses the app since the navigation stack just keeps getting bigger.