-
-
Notifications
You must be signed in to change notification settings - Fork 241
/
Copy pathcustom-tabs.component.ts
44 lines (37 loc) · 1.19 KB
/
custom-tabs.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { Component, OnInit } from '@angular/core';
import { ModalDialogService, ModalDialogOptions } from "nativescript-angular/directives/dialogs";
import { RouterExtensions } from "nativescript-angular/router";
import { ActivatedRoute } from "@angular/router";
import { confirm } from "tns-core-modules/ui/dialogs";
import { Page } from 'tns-core-modules/ui/page/page';
@Component({
moduleId: module.id,
selector: 'custom-tabs',
templateUrl: './custom-tabs.component.html'
})
export class CustomTabsComponent implements OnInit {
constructor(
private activeRoute: ActivatedRoute,
private routerExtension: RouterExtensions,
private page: Page) { }
ngOnInit() {
}
canGoBackParentRoute() {
const canGoBackParentRoute = this.routerExtension.canGoBack({ relativeTo: this.activeRoute });
const title = "CanGoBack(ParentRoute)";
this.onShowDialog(title, title + ` ${canGoBackParentRoute}`);
}
onRootBack() {
this.page.frame.goBack();
}
onShowDialog(title: string, result: string) {
let options: any = {
title: title,
message: result,
okButtonText: "Ok"
}
confirm(options).then((result: boolean) => {
console.log(result);
})
}
}