Skip to content

Commit 89f21c8

Browse files
author
vakrilov
committed
FIX: Trigger CD in modal(onPush) example
1 parent 5cc6b7b commit 89f21c8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/modal/modal-dialogs/modal-dialog.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, ChangeDetectionStrategy, ViewContainerRef } from '@angular/core';
1+
import { Component, ChangeDetectionStrategy, ViewContainerRef, ChangeDetectorRef } from '@angular/core';
22
import { ModalDialogService, ModalDialogOptions, ModalDialogParams } from "nativescript-angular/directives/dialogs";
33

44
@Component({
@@ -70,7 +70,10 @@ export class ModalTest {
7070
export class ModalTestWithPushStrategy {
7171
public result: string = "---";
7272

73-
constructor(private modal: ModalDialogService, private vcRef: ViewContainerRef) { }
73+
constructor(
74+
private modal: ModalDialogService,
75+
private vcRef: ViewContainerRef,
76+
private cdRef: ChangeDetectorRef) { }
7477

7578
public showModal() {
7679
const options: ModalDialogOptions = {
@@ -81,6 +84,7 @@ export class ModalTestWithPushStrategy {
8184

8285
this.modal.showModal(ModalContent, options).then((res: string) => {
8386
this.result = res || "empty result";
87+
this.cdRef.markForCheck();
8488
});
8589
}
8690

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@
3737
"nativescript-dev-typescript": "^0.3.2",
3838
"typescript": "^2.0.2"
3939
}
40-
}
40+
}

0 commit comments

Comments
 (0)