mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
fix(navCtrl): clean up class/style
This commit is contained in:
@ -910,10 +910,15 @@ export class NavController extends Ion {
|
|||||||
let viewContainer = this._viewManager.getViewContainer(location);
|
let viewContainer = this._viewManager.getViewContainer(location);
|
||||||
let hostViewRef =
|
let hostViewRef =
|
||||||
viewContainer.createHostView(hostProtoViewRef, viewContainer.length, providers);
|
viewContainer.createHostView(hostProtoViewRef, viewContainer.length, providers);
|
||||||
let newLocation = this._viewManager.getHostElement(hostViewRef);
|
let pageElementRef = this._viewManager.getHostElement(hostViewRef);
|
||||||
let component = this._viewManager.getComponent(newLocation);
|
let component = this._viewManager.getComponent(pageElementRef);
|
||||||
|
|
||||||
viewCtrl.addDestroy(() => {
|
viewCtrl.addDestroy(() => {
|
||||||
|
// ensure the element is cleaned up for when the view pool reuses this element
|
||||||
|
this._renderer.setElementAttribute(pageElementRef, 'class', null);
|
||||||
|
this._renderer.setElementAttribute(pageElementRef, 'style', null);
|
||||||
|
|
||||||
|
// remove the page from its container
|
||||||
let index = viewContainer.indexOf(hostViewRef);
|
let index = viewContainer.indexOf(hostViewRef);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
viewContainer.remove(index);
|
viewContainer.remove(index);
|
||||||
@ -925,7 +930,7 @@ export class NavController extends Ion {
|
|||||||
viewCtrl.setInstance(component);
|
viewCtrl.setInstance(component);
|
||||||
|
|
||||||
// remember the ElementRef to the ion-page elementRef that was just created
|
// remember the ElementRef to the ion-page elementRef that was just created
|
||||||
viewCtrl.setPageRef(newLocation);
|
viewCtrl.setPageRef(pageElementRef);
|
||||||
|
|
||||||
if (!navbarContainerRef) {
|
if (!navbarContainerRef) {
|
||||||
navbarContainerRef = viewCtrl.getNavbarViewRef();
|
navbarContainerRef = viewCtrl.getNavbarViewRef();
|
||||||
|
Reference in New Issue
Block a user