feat(nav-controller): remove method

This commit is contained in:
Tim Lancina
2015-10-08 20:42:24 -05:00
parent f199e65767
commit 7ccdfed018
3 changed files with 26 additions and 3 deletions

View File

@ -335,6 +335,26 @@ export class NavController extends Ion {
return Promise.resolve();
}
/**
* Removes a view from the nav stack at the specified index.
* @param {TODO} index TODO
* @returns {Promise} TODO
*/
remove(index) {
if (index < 0 || index >= this._views.length) {
return Promise.reject("Index out of range");
}
let viewToRemove = this._views[index];
if (this.isActive(viewToRemove)){
return this.pop();
} else {
this._remove(index);
viewToRemove.destroy();
return Promise.resolve();
}
}
/**
* Set the view stack to reflect the given component classes.
* @param {TODO} components TODO