1
1
import { Component , OnInit , OnDestroy } from "@angular/core" ;
2
- import { ActivatedRoute , Router , Route } from "@angular/router" ;
2
+ import { ActivatedRoute } from "@angular/router" ;
3
3
4
4
import { RouterExtensions } from "nativescript-angular/router" ;
5
5
import { Page } from "tns-core-modules/ui/page" ;
6
6
import { Observable } from "rxjs" ;
7
7
import { map } from "rxjs/operators" ;
8
+ import { CounterService } from "../counter.service" ;
8
9
9
10
@Component ( {
10
11
selector : "second" ,
@@ -19,6 +20,8 @@ import { map } from "rxjs/operators";
19
20
<Button text="LOAD NESTED NAMED OUTLET" (tap)="loadNestedNamedOutlet()"></Button>
20
21
<Button text="BACK" automationText="BACK" (tap)="goBack()"></Button>
21
22
23
+ <Button text="TICK" automationText="TICK" (tap)="service.tick()"></Button>
24
+
22
25
<GridLayout row="1" rows="*,*">
23
26
<GridLayout row="0" class="nested-outlet">
24
27
<router-outlet></router-outlet>
@@ -33,7 +36,11 @@ export class SecondComponent implements OnInit, OnDestroy {
33
36
public depth$ : Observable < string > ;
34
37
public nextDepth$ : Observable < number > ;
35
38
36
- constructor ( private routerExt : RouterExtensions , private route : ActivatedRoute , page : Page ) {
39
+ constructor (
40
+ private routerExt : RouterExtensions ,
41
+ private route : ActivatedRoute ,
42
+ public service : CounterService ,
43
+ page : Page ) {
37
44
console . log ( "SecondComponent - constructor() page: " + page ) ;
38
45
this . depth$ = route . params . pipe ( map ( r => r [ "depth" ] ) ) ;
39
46
this . nextDepth$ = route . params . pipe ( map ( r => + r [ "depth" ] + 1 ) ) ;
0 commit comments