-
-
Notifications
You must be signed in to change notification settings - Fork 241
/
Copy pathlazy.component.ts
43 lines (36 loc) · 1.26 KB
/
lazy.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
import { Component, OnInit, OnDestroy, OnChanges } from "@angular/core";
import { ActivatedRoute, Router, Route } from "@angular/router";
import { Location } from "@angular/common";
import { RouterExtensions } from "@nativescript/angular";
import { Page } from "@nativescript/core";
@Component({
selector: "lazy",
template: `
<StackLayout>
<Label text="LazyComponent" class="header"></Label>
<Button text="GO TO C-LESS LAZY" [nsRouterLink]="['/lazy','nest','more']"></Button>
<Button text="GO TO FIRST" [nsRouterLink]="['/first']"></Button>
<Button text="BACK" (tap)="goBack()"></Button>
<Label [text]="message"></Label>
</StackLayout>`
})
export class LazyComponent implements OnInit, OnDestroy {
public message: string = "";
constructor(private routerExt: RouterExtensions, page: Page) {
console.log("LazyComponent - constructor() page: " + page);
}
ngOnInit() {
console.log("LazyComponent - ngOnInit()");
}
ngOnDestroy() {
console.log("LazyComponent - ngOnDestroy()");
}
goBack() {
this.message = "";
if (this.routerExt.canGoBack()) {
this.routerExt.back();
} else {
this.message = "canGoBack() - false"
}
}
}