Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49087

How can I route to a specific (sub)-view or change the view?

$
0
0

@MaKin wrote:

I've created a state with multiple views. Can you tell me how to route to a specific view?

app.js:

.state('tabs.movies', {
  url: '/movies',
  views: {
    'movies-tab': {
    templateUrl: 'templates/movies.html',
    controller: 'MoviesCtrl'
  },
  'movies-tab-grid': {
    templateUrl: 'templates/movies_grid.html',
    controller: 'MoviesCtrl'
  },
  'movies-tab-list': {
    templateUrl: 'templates/movies_list.html',
    controller: 'MoviesCtrl'
  }
}
  })

The three (sub) views are about to show the same content but with different layouts (Slides, Grid, List). I also tried to use ng-switch / ng-if, but whenever I wrap my carousel (ks-swiper-container) with a div-container, it completely disappears. So I thought routing might be the better way.

I would then like to create a button to switch the (sub) views like this:

<ion-nav-buttons side="secondary">
  <button class="button button-icon ion-grid" ng-click="">
  </button>
</ion-nav-buttons>

I know that routing can be done in several ways (e.g. with a href) but I have no idea how to route to a view instead of a specific state or route to a state showing a specific view.

Any help is much appreciated!
Thanks in advance.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49087

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>