diff --git a/ng-sample/app/app.ts b/ng-sample/app/app.ts
index 031590c71..fe26d72d3 100644
--- a/ng-sample/app/app.ts
+++ b/ng-sample/app/app.ts
@@ -23,7 +23,7 @@ import {ListTestAsync} from "./examples/list/list-test-async";
import {ImageTest} from "./examples/image/image-test";
import {NavigationTest} from "./examples/navigation/navigation-test";
import {ActionBarTest} from "./examples/action-bar/action-bar-test";
-
+import {ModalTest} from "./examples/modal/modal-test";
nativeScriptBootstrap(RendererTest);
//nativeScriptBootstrap(Benchmark);
@@ -35,3 +35,4 @@ nativeScriptBootstrap(RendererTest);
//nativeScriptBootstrap(ImageTest);
//nativeScriptBootstrap(NavigationTest, [NS_ROUTER_PROVIDERS]);
//nativeScriptBootstrap(ActionBarTest, [NS_ROUTER_PROVIDERS], { startPageActionBarHidden: false });
+// nativeScriptBootstrap(ModalTest);
diff --git a/ng-sample/app/examples/action-bar/action-bar-test.ts b/ng-sample/app/examples/action-bar/action-bar-test.ts
index f35fe62e5..493416e94 100644
--- a/ng-sample/app/examples/action-bar/action-bar-test.ts
+++ b/ng-sample/app/examples/action-bar/action-bar-test.ts
@@ -31,7 +31,7 @@ class FirstComponent {
@Component({
- selector: "nested-componenet",
+ selector: "nested-component",
directives: [NS_ROUTER_DIRECTIVES, NS_DIRECTIVES],
template: `
@@ -65,7 +65,7 @@ class NestedComponent {
-
+
`,
})
diff --git a/ng-sample/app/examples/modal/modal-content.ts b/ng-sample/app/examples/modal/modal-content.ts
new file mode 100644
index 000000000..132a422b5
--- /dev/null
+++ b/ng-sample/app/examples/modal/modal-content.ts
@@ -0,0 +1,35 @@
+import {Component} from 'angular2/core';
+import {ModalDialogParams} from "../../nativescript-angular/directives/dialogs";
+
+@Component({
+ selector: 'modal-content',
+ template: `
+
+
+
+
+
+
+
+ `
+})
+export class ModalContent {
+ public prompt: string;
+ constructor(private params: ModalDialogParams) {
+ console.log("ModalContent.constructor: " + JSON.stringify(params))
+ this.prompt = params.context.promptMsg;
+ }
+
+ public close(res: string) {
+ this.params.closeCallback(res);
+ }
+
+ ngOnInit() {
+ console.log("ModalContent.ngOnInit");
+
+ }
+
+ ngOnDestroy() {
+ console.log("ModalContent.ngOnDestroy");
+ }
+}
\ No newline at end of file
diff --git a/ng-sample/app/examples/modal/modal-test.ts b/ng-sample/app/examples/modal/modal-test.ts
new file mode 100644
index 000000000..c174c1bc3
--- /dev/null
+++ b/ng-sample/app/examples/modal/modal-test.ts
@@ -0,0 +1,104 @@
+import {Component} from 'angular2/core';
+import * as dialogs from "ui/dialogs";
+import {ModalDialogService, ModalDialogOptions, ModalDialogHost} from "../../nativescript-angular/directives/dialogs";
+import {ModalContent} from "./modal-content";
+
+@Component({
+ selector: 'modal-test',
+ directives: [ModalDialogHost],
+ providers: [ModalDialogService],
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `
+})
+export class ModalTest {
+ public result: string = "result";
+
+ constructor(private modal: ModalDialogService) {
+ }
+
+ public showModal(fullscreen: boolean) {
+ var options: ModalDialogOptions = {
+ context: { promptMsg: "This is the prompt message!" },
+ fullscreen: fullscreen
+ };
+
+ this.modal.showModal(ModalContent, options).then((res: string) => {
+ this.result = res || "empty result";
+ })
+ }
+
+ public showAlert() {
+ dialogs.alert({
+ title: "Alert Title",
+ message: "The name will change.",
+ okButtonText: "OK"
+ }).then(() => {
+ this.result = "alert closed";
+ });
+ }
+
+ public showConfirm() {
+ dialogs.confirm({
+ title: "Name",
+ message: "Do you want to change the name?",
+ cancelButtonText: "No",
+ neutralButtonText: "Ignore",
+ okButtonText: "Yes"
+ }).then((confirmResult) => {
+ this.result = confirmResult + "";
+ });
+ }
+
+ public showPrompt() {
+ dialogs.prompt({
+ title: "Name",
+ message: "Enter name:",
+ cancelButtonText: "Cancel",
+ neutralButtonText: "Ignore",
+ okButtonText: "OK",
+ defaultText: "John Reese",
+ inputType: dialogs.inputType.text
+ }).then((promptResult) => {
+ this.result = promptResult.result ? promptResult.text : "no result";
+ });
+ }
+
+ public showAction() {
+ dialogs.action({
+ message: "Choose action:",
+ cancelButtonText: "Close",
+ actions: ["Foo", "Bar"]
+ }).then((actionResult) => {
+ this.result = actionResult;
+ });
+ }
+
+ public showLogin() {
+ dialogs.login({
+ title: "Name",
+ message: "Enter name:",
+ cancelButtonText: "Cancel",
+ neutralButtonText: "Ignore",
+ okButtonText: "OK",
+ userName: "John",
+ password: "Reese"
+ }).then((loginResult) => {
+ this.result = loginResult.result ? ("user: " + loginResult.userName + " pass: " + loginResult.password) : "no result";
+ });
+ }
+}
diff --git a/ng-sample/app/examples/navigation/nav-component.ts b/ng-sample/app/examples/navigation/nav-component.ts
index 115b941cb..10f94a9ae 100644
--- a/ng-sample/app/examples/navigation/nav-component.ts
+++ b/ng-sample/app/examples/navigation/nav-component.ts
@@ -73,7 +73,7 @@ class DetailComponent {
directives: [ROUTER_DIRECTIVES, NS_ROUTER_DIRECTIVES],
template: `
-