chore(nav): add promise rejects to popTo

This commit is contained in:
Adam Bradley
2016-06-01 22:19:09 -05:00
parent fc29124870
commit 9cd80cbfe8

View File

@ -745,6 +745,10 @@ export class NavController extends Ion {
*/ */
popTo(view: ViewController, opts?: NavOptions): Promise<any> { popTo(view: ViewController, opts?: NavOptions): Promise<any> {
let startIndex = this.indexOf(view); let startIndex = this.indexOf(view);
if (startIndex < 0) {
return Promise.reject('View not found to pop to');
}
let activeView = this.getByState(STATE_TRANS_ENTER) || let activeView = this.getByState(STATE_TRANS_ENTER) ||
this.getByState(STATE_INIT_ENTER) || this.getByState(STATE_INIT_ENTER) ||
this.getActive(); this.getActive();