fix(NavController): default setRoot/setPages to not animate transitions

setRoot() will be commonly used by side menus, which should not animate between pages.
This commit is contained in:
Adam Bradley
2016-01-21 16:38:57 -06:00
parent ba0a041e86
commit f5f4169db0
2 changed files with 11 additions and 9 deletions

View File

@@ -5,13 +5,12 @@ import {App, IonicApp, Page, NavController, Alert} from 'ionic/ionic';
templateUrl: 'page1.html'
})
class Page1 {
constructor(nav: NavController) {
this.nav = nav;
}
constructor(private nav: NavController) {}
presentAlert() {
let alert = Alert.create({
title: "New Friend!",
body: "Your friend, Obi wan Kenobi, just accepted your friend request!",
message: "Your friend, Obi wan Kenobi, just accepted your friend request!",
cssClass: 'my-alert',
buttons: ['Ok']
});
@@ -26,9 +25,8 @@ class Page3 {}
@Page({templateUrl: 'page2.html'})
class Page2 {
constructor(nav: NavController) {
this.nav = nav;
}
constructor(private nav: NavController) {}
page3() {
this.nav.push(Page3);
}
@@ -40,8 +38,7 @@ class Page2 {
})
class E2EApp {
constructor(app: IonicApp) {
this.app = app;
constructor(private app: IonicApp) {
this.rootView = Page1;
this.changeDetectionCount = 0;

View File

@@ -254,6 +254,11 @@ export class NavController extends Ion {
let views = pages.map(p => new ViewController(p.page, p.params));
let enteringView = this._insert(0, views);
// if animation wasn't set to true then default it to NOT animate
if (opts.animate !== true) {
opts.animate = false;
}
// set the nav direction to "back" if it wasn't set
opts.direction = opts.direction || 'back';