Skip to content

Commit aacdf7c

Browse files
author
vakrilov
committed
feat(router): detach change detection on navigation
1 parent 29f2b2f commit aacdf7c

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

e2e/router/app/first/first.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ export class FirstComponent implements OnInit, OnDestroy {
3636
console.log("FirstComponent - ngOnDestroy()");
3737
}
3838

39+
ngDoCheck() {
40+
console.log("FirstComponent - ngDoCheck()");
41+
}
42+
43+
ngOnChanges(){
44+
console.log("FirstComponent - ngOnChanges()");
45+
}
46+
3947
goBack() {
4048
this.message = "";
4149
if (this.routerExt.canGoBack()) {

nativescript-angular/router/page-router-outlet.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,10 @@ export class PageRouterOutlet implements OnDestroy { // tslint:disable-line:dire
204204
}
205205

206206
log("PageRouterOutlet.detach() - " + routeToString(this._activatedRoute));
207-
207+
208+
// Detach from ChangeDetection
209+
this.activated.hostView.detach();
210+
208211
const component = this.activated;
209212
this.activated = null;
210213
this._activatedRoute = null;
@@ -218,6 +221,9 @@ export class PageRouterOutlet implements OnDestroy { // tslint:disable-line:dire
218221
log("PageRouterOutlet.attach() - " + routeToString(activatedRoute));
219222

220223
this.activated = ref;
224+
225+
// reattach to ChangeDetection
226+
this.activated.hostView.reattach();
221227
this._activatedRoute = activatedRoute;
222228

223229
this.markActivatedRoute(activatedRoute);

0 commit comments

Comments
 (0)