Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #309 from NativeScript/modal_page_actionbar
modal page with ActionBar example
- Loading branch information
Showing
10 changed files
with
139 additions
and
5 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
app/ng-ui-widgets-category/modal-page/modal-page-actionbar/article.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Modal Dialog with ActionBar | ||
|
||
Defining the main view component | ||
<snippet id='main-view-html'/> | ||
<snippet id='main-view-code'/> | ||
|
||
Definig modal page innner component's routes | ||
|
||
<snippet id='modal-page-routes-actionbar'/> | ||
|
||
Defining the modal root component | ||
<snippet id='modal-root-html'/> | ||
<snippet id='modal-root-code'/> | ||
|
||
Defining the modal view component with an ActionBar | ||
<snippet id='modal-view-actionbar-html'/> | ||
<snippet id='modal-view-actionbar-code'/> |
5 changes: 5 additions & 0 deletions
5
app/ng-ui-widgets-category/modal-page/modal-page-actionbar/main-view.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!-- >> modal-view-html --> | ||
<StackLayout class="page" sdkExampleTitle sdkToggleNavButton> | ||
<Button text="SHOW MODAL" (tap)="onTap()"></Button> | ||
</StackLayout> | ||
<!-- << modal-view-html --> |
31 changes: 31 additions & 0 deletions
31
app/ng-ui-widgets-category/modal-page/modal-page-actionbar/main-view.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Component, OnInit, ViewContainerRef } from "@angular/core"; | ||
import { ModalDialogOptions, ModalDialogService } from "nativescript-angular/modal-dialog"; | ||
|
||
import { ModalRootComponent } from "./modal-root.component"; | ||
|
||
@Component({ | ||
moduleId: module.id, | ||
providers: [ModalDialogService], | ||
templateUrl: "./main-view.component.html" | ||
}) | ||
export class MainViewComponent implements OnInit { | ||
constructor( | ||
private _modalService: ModalDialogService, | ||
private _vcRef: ViewContainerRef) { } | ||
|
||
ngOnInit(): void { } | ||
// >> main-view-code | ||
onTap(): void { | ||
const options: ModalDialogOptions = { | ||
viewContainerRef: this._vcRef, | ||
context: {}, | ||
fullscreen: true | ||
}; | ||
|
||
this._modalService.showModal(ModalRootComponent, options) | ||
.then((result: string) => { | ||
console.log(result); | ||
}); | ||
} | ||
// << main-view-code | ||
} |
3 changes: 3 additions & 0 deletions
3
app/ng-ui-widgets-category/modal-page/modal-page-actionbar/modal-root.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- >> modal-root-html --> | ||
<page-router-outlet></page-router-outlet> | ||
<!-- << modal-root-html --> |
19 changes: 19 additions & 0 deletions
19
app/ng-ui-widgets-category/modal-page/modal-page-actionbar/modal-root.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// >> modal-root-code | ||
import { Component, OnInit } from "@angular/core"; | ||
import { RouterExtensions } from "nativescript-angular/router"; | ||
import { ActivatedRoute } from "@angular/router"; | ||
|
||
@Component({ | ||
moduleId: module.id, | ||
templateUrl: "./modal-root.component.html" | ||
}) | ||
export class ModalRootComponent implements OnInit { | ||
constructor( | ||
private _routerExtensions: RouterExtensions, | ||
private _activeRoute: ActivatedRoute) {} | ||
|
||
ngOnInit(): void { | ||
this._routerExtensions.navigate(["modal-view"], { relativeTo: this._activeRoute }); | ||
} | ||
} | ||
// << modal-root-code |
10 changes: 10 additions & 0 deletions
10
app/ng-ui-widgets-category/modal-page/modal-page-actionbar/modal-view.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.action-bar, .page { | ||
background-color: chocolate; | ||
} | ||
.my-label { | ||
border-radius: 5; | ||
color: white; | ||
font-family: FontAwesome; | ||
font-size: 24; | ||
vertical-align: middle; | ||
} |
9 changes: 9 additions & 0 deletions
9
app/ng-ui-widgets-category/modal-page/modal-page-actionbar/modal-view.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!-- >> modal-view-actionbar-html --> | ||
<ActionBar backgroundColor="red" title="MODAL VIEW" class="action-bar"> | ||
</ActionBar> | ||
|
||
<StackLayout backgroundColor="green" class="page"> | ||
<Label class="my-label" style="text-align: center;" text="Modal Page with ActionBar" textWrap="true"></Label> | ||
<Button text="CLOSE MODAL" (tap)="onClose()"></Button> | ||
</StackLayout> | ||
<!-- << modal-view-actionbar-html --> |
22 changes: 22 additions & 0 deletions
22
app/ng-ui-widgets-category/modal-page/modal-page-actionbar/modal-view.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// tslint:disable:max-line-length | ||
// >> modal-view-actionbar-code | ||
import { Component, OnInit } from "@angular/core"; | ||
import { RouterExtensions } from "nativescript-angular/router"; | ||
import { ActivatedRoute } from "@angular/router"; | ||
import { ModalDialogParams } from "nativescript-angular/modal-dialog"; | ||
import { Page } from "ui/page"; | ||
|
||
@Component({ | ||
moduleId: module.id, | ||
templateUrl: "./modal-view.component.html", | ||
styleUrls: ["./modal-view.component.css"] | ||
}) | ||
export class ModalViewActionBarComponent implements OnInit { | ||
constructor(private _params: ModalDialogParams, private _page: Page, private router: RouterExtensions, private _activeRoute: ActivatedRoute) {} | ||
|
||
ngOnInit(): void {} | ||
onClose(): void { | ||
this._params.closeCallback("return value"); | ||
} | ||
} | ||
// << modal-view-actionbar-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters