-
-
Notifications
You must be signed in to change notification settings - Fork 241
/
Copy pathnested-detail.component.ts
38 lines (33 loc) · 1.18 KB
/
nested-detail.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
import { Component, OnInit, OnDestroy } from "@angular/core";
import { ActivatedRoute, Router, Route } from "@angular/router";
import { Location } from "@angular/common";
import { Observable } from "rxjs";
import { map } from "rxjs/operators";
import { Page } from "@nativescript/core";
import { RouterExtensions } from "@nativescript/angular";
@Component({
selector: "nested-detail",
template: `
<GridLayout rows="auto, auto">
<Label [text]="'nested-named-param: ' + (id$ | async)"></Label>
<Button row="1" text="BACK-NESTED" (tap)="goBack()"></Button>
</GridLayout>
`
})
export class NestedDetailComponent {
public id$: Observable<string>;
constructor(private router: Router, private route: ActivatedRoute, private page: Page, private routerExt: RouterExtensions) {
this.page.actionBar.title = "NamedNestedDetail";
console.log("DetailComponent - constructor()");
this.id$ = route.params.pipe(map(r => r["id"]));
}
ngOnInit() {
console.log("DetailComponent - ngOnInit()");
}
ngOnDestroy() {
console.log("DetailComponent - ngOnDestroy()");
}
goBack(){
this.routerExt.back();
}
}