mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
feat(nav-controller): remove method
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user