mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 10:01:59 +08:00
fix(angular): ngOnDestroy runs inside angular zone (#24949)
Resolves #22571
This commit is contained in:
@ -20,6 +20,12 @@ describe('Nested Outlet', () => {
|
||||
cy.ionPageVisible('app-nested-outlet-page2');
|
||||
|
||||
cy.get('ion-router-outlet ion-router-outlet app-nested-outlet-page2 h1').should('have.text', 'Nested page 2');
|
||||
|
||||
cy.get('#goto-nested-page1').click();
|
||||
cy.ionPageVisible('app-nested-outlet-page');
|
||||
|
||||
cy.get('#goto-nested-page2').click();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
@ -1,8 +1,16 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, NgZone, OnDestroy, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-nested-outlet-page',
|
||||
templateUrl: './nested-outlet-page.component.html',
|
||||
})
|
||||
export class NestedOutletPageComponent {
|
||||
export class NestedOutletPageComponent implements OnDestroy, OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
NgZone.assertInAngularZone();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
NgZone.assertInAngularZone();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<ion-content>
|
||||
<h1>Nested page 2</h1>
|
||||
<p>
|
||||
<ion-button routerLink="/nested-outlet/page">Go To FIRST</ion-button>
|
||||
</p>
|
||||
</ion-content>
|
||||
<h1>Nested page 2</h1>
|
||||
<p>
|
||||
<ion-button routerLink="/nested-outlet/page" id="goto-nested-page1">Go To FIRST</ion-button>
|
||||
</p>
|
||||
</ion-content>
|
||||
|
@ -1,8 +1,16 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, NgZone, OnDestroy, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-nested-outlet-page2',
|
||||
templateUrl: './nested-outlet-page2.component.html',
|
||||
})
|
||||
export class NestedOutletPage2Component {
|
||||
export class NestedOutletPage2Component implements OnDestroy, OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
NgZone.assertInAngularZone();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
NgZone.assertInAngularZone();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user