Skip to content

Commit

Permalink
fix(nav): returning Promise<false> in canLeave / canEnter works as ex…
Browse files Browse the repository at this point in the history
…pected
  • Loading branch information
manucorporat committed Nov 4, 2016
1 parent 63d495a commit 5f1a862
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/navigation/nav-controller-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,13 @@ export class NavControllerBase extends Ion implements NavController {
if (promises.length) {
// darn, async promises, gotta wait for them to resolve
Promise.all(promises)
.then(() => this._postViewInit(enteringView, leavingView, ti, resolve))
.catch(reject);
.then((values: any[]) => {
if (values.some(result => result === false)) {
reject(`ionViewCanEnter rejected`);
} else {
this._postViewInit(enteringView, leavingView, ti, resolve);
}
}).catch(reject);
} else {
// synchronous and all tests passed! let's move on already
this._postViewInit(enteringView, leavingView, ti, resolve);
Expand Down

0 comments on commit 5f1a862

Please sign in to comment.