docs(nav): .catch() is not longer needed

This commit is contained in:
Manuel Mtz-Almeida
2017-04-18 23:42:49 +02:00
parent ff467db339
commit 356ccd9e1c
11 changed files with 28 additions and 47 deletions

View File

@@ -256,9 +256,7 @@ export class AlertCmp {
}
if (shouldDismiss) {
this.dismiss(button.role).catch(() => {
console.debug('alert can not be dismissed');
});
this.dismiss(button.role);
}
}

View File

@@ -98,9 +98,7 @@ export class ModalCmp {
const opts: NavOptions = {
minClickBlockDuration: 400
};
return this._viewCtrl.dismiss(null, 'backdrop', opts).catch(() => {
console.debug('Dismiss modal by clicking backdrop was cancelled');
});
return this._viewCtrl.dismiss(null, 'backdrop', opts);
}
}

View File

@@ -42,9 +42,7 @@ export class ModalPassData {
submit() {
console.time('modal');
this.viewCtrl.dismiss(this.data).catch(() => {
console.log('submit was cancelled');
});
this.viewCtrl.dismiss(this.data);
}
ionViewCanEnter() {

View File

@@ -74,9 +74,7 @@ export class NavPush {
@HostListener('click')
onClick(): boolean {
if (this._nav && this.navPush) {
this._nav.push(this.navPush, this.navParams).catch(() => {
console.debug('navPush was rejected');
});
this._nav.push(this.navPush, this.navParams);
return false;
}
return true;

View File

@@ -84,6 +84,7 @@ export class FirstPage {
}
ionViewCanLeave() {
this.called.ionViewCanLeave++;
if (this.canLeave) {
return true;
}
@@ -93,8 +94,6 @@ export class FirstPage {
alert.addButton({ text: 'Umm, ok', role: 'cancel', });
alert.present();
this.called.ionViewCanLeave++;
return false;
}
@@ -132,7 +131,6 @@ export class FirstPage {
this.navCtrl.push('full-page', { id: 8675309, myData: [1, 2, 3, 4] }, {
animate: true,
animation: 'md-transition'
}).catch(() => {
});
}
@@ -140,36 +138,30 @@ export class FirstPage {
this.navCtrl.push('another-page', null, {
animate: true,
animation: 'wp-transition'
}).catch(() => {
});
}
pushTabsPage() {
this.navCtrl.push('tabs').catch(() => {
});
this.navCtrl.push('tabs');
}
quickPush() {
this.navCtrl.push('another-page').catch(() => {
});
this.navCtrl.push('another-page');
setTimeout(() => {
this.navCtrl.push('primary-header-page').catch(() => {
});
this.navCtrl.push('primary-header-page');
}, 150);
}
quickPop() {
this.navCtrl.push('another-page').catch(() => {
});
this.navCtrl.push('another-page');
setTimeout(() => {
this.navCtrl.remove(1, 1).catch(() => {
});
this.navCtrl.remove(1, 1);
}, 250);
}
pop() {
this.navCtrl.pop().catch(() => {});
this.navCtrl.pop();
}
viewDismiss() {

View File

@@ -42,6 +42,7 @@ export class Tab3 {
}
presentModal() {
console.debug('modal was commented out');
// this.modalCtrl.create(MyModal).present();
}

View File

@@ -132,9 +132,11 @@ export class Page4 extends Base {
setTimeout(() => {
this.doSomethingSync();
setTimeout(() => {
this.nav.push(Page5).catch(() => {
this.nav.push(Page6, { continue: false });
setTimeout(() => this.nav.push(Page6, { continue: true }), 510);
this.nav.push(Page5).then((hasCompleted) => {
if (!hasCompleted) {
this.nav.push(Page6, { continue: false });
setTimeout(() => this.nav.push(Page6, { continue: true }), 510);
}
});
}, 2000);
}, 0);
@@ -202,10 +204,12 @@ export class Page6 extends Base {
}
pop() {
this.nav.pop().then(() => {
this.pushPage7();
}).catch(() => {
this.pop();
this.nav.pop().then((hasCompleted) => {
if (hasCompleted) {
this.pushPage7();
} else {
this.pop();
}
});
}

View File

@@ -506,9 +506,7 @@ export class Tabs extends Ion implements AfterViewInit, RootNode {
} else if (tab.length() > 1) {
// if we're a few pages deep, pop to root
tab.popToRoot().catch(() => {
console.debug('Tabs: pop to root was cancelled');
});
tab.popToRoot();
} else {
getComponent(this._linker, tab.root).then(viewController => {
if (viewController.component !== active.component) {

View File

@@ -28,9 +28,7 @@ export class Tab1Page1 {
}
logout() {
this.app.getRootNav().setRoot('sign-in', null, { animate: true, direction: 'back' }).catch(() => {
console.debug('logout cancelled');
});
this.app.getRootNav().setRoot('sign-in', null, { animate: true, direction: 'back' });
}
ionViewWillEnter() {

View File

@@ -37,9 +37,7 @@ export class TabsPage {
}
logout() {
this.navCtrl.pop().catch(() => {
console.log('Cannot go back.');
});
this.navCtrl.pop();
}
ionViewCanLeave() {