1
1
import { Component } from "@angular/core" ;
2
- import { RouteConfig } from '@angular/router-deprecated ' ;
3
- import { NS_ROUTER_DIRECTIVES } from "nativescript-angular/router-deprecated " ;
4
- import { ActionBarTest } from "../action-bar/action-bar-test" ;
2
+ import { RouterConfig } from '@angular/router' ;
3
+ import { NS_ROUTER_DIRECTIVES , nsProvideRouter } from "nativescript-angular/router" ;
4
+
5
5
import { FirstComponentActionBar } from "../action-bar/action-bar-first.component" ;
6
6
import { SecondComponentActionBar } from "../action-bar/action-bar-second.component" ;
7
+
7
8
import { AppComponent } from "../template/app.component" ;
9
+
8
10
import { FirstComponent } from "../components/first.component" ;
9
11
import { SecondComponent } from "../components/second.component" ;
10
- import { NavigationTestRouter } from "../router/router-outlet" ;
12
+ import { NavigationTestRouter , NavigationSubRoutes } from "../router/router-outlet" ;
13
+
11
14
import { BindingComponent } from "../binding/binding-page" ;
15
+
12
16
import { ListViewComponent } from "../listView/commonTemplate/list-view-page" ;
13
17
import { ListViewControlComponent } from "../listView/customTemplate/list-view-item-template" ;
14
18
import { ListViewAsyncPipeComponent } from "../listView/asyncPipeTemplate/async-pipe-template"
15
19
import { ListViewMainPageComponent } from "../listView/listViewMainPage/list-view-main-page"
20
+
16
21
import { ModalTest , ModalTestWithPushStrategy } from "../modal/modal-dialog.component" ;
17
22
18
23
@Component ( {
@@ -21,24 +26,29 @@ import { ModalTest, ModalTestWithPushStrategy } from "../modal/modal-dialog.comp
21
26
template : `
22
27
<StackLayout>
23
28
<Label text="Main Component" class="title"></Label>
29
+
24
30
<StackLayout orientation="horizontal" horizontalAlignment="center">
25
- <Button text="Template" [nsRouterLink]="['Template ']"></Button>
26
- <Button text="Router" [nsRouterLink]="['Router ']"></Button>
31
+ <Button text="Template" [nsRouterLink]="['template ']"></Button>
32
+ <Button text="Router" [nsRouterLink]="['router ']"></Button>
27
33
</StackLayout>
34
+
28
35
<StackLayout orientation="horizontal" horizontalAlignment="center">
29
- <Button text="First" [nsRouterLink]="['First ']"></Button>
30
- <Button text="Second" [nsRouterLink]="['Second ']"></Button>
36
+ <Button text="First" [nsRouterLink]="['first ']"></Button>
37
+ <Button text="Second" [nsRouterLink]="['second ']"></Button>
31
38
</StackLayout>
32
- <!--<Button text="ActionBar" [nsRouterLink]="['ActionBar']"></Button>-->
39
+
33
40
<StackLayout orientation="horizontal" horizontalAlignment="center">
34
- <Button text="ActionBar1" [nsRouterLink]="['FirstActionBar ']"></Button>
35
- <Button text="ActionBar2" [nsRouterLink]="['SecondActionBar ']"></Button>
41
+ <Button text="ActionBar1" [nsRouterLink]="['first-action-bar ']"></Button>
42
+ <Button text="ActionBar2" [nsRouterLink]="['second-action-bar ']"></Button>
36
43
</StackLayout>
37
- <Button text="Binding" [nsRouterLink]="['Binding']"></Button>
38
- <Button text="ListViewExamples" [nsRouterLink]="['ListViewMainPage']"></Button>
39
- <StackLayout orientation="horizontal" horizontalAlignment="center">
40
- <Button text="modal" [nsRouterLink]="['Modal']"></Button>
41
- <Button text="modal(onPush)" [nsRouterLink]="['ModalWithPushStrategy']"></Button>
44
+
45
+ <Button text="Binding" [nsRouterLink]="['binding']"></Button>
46
+
47
+ <Button text="ListViewExamples" [nsRouterLink]="['listView']"></Button>
48
+
49
+ <StackLayout orientation="horizontal" horizontalAlignment="center">
50
+ <Button text="modal" [nsRouterLink]="['modal']"></Button>
51
+ <Button text="modal(onPush)" [nsRouterLink]="['modal-on-push']"></Button>
42
52
</StackLayout>
43
53
</StackLayout>
44
54
` ,
@@ -50,22 +60,27 @@ class MainComponent { }
50
60
directives : [ NS_ROUTER_DIRECTIVES ] ,
51
61
template : `<page-router-outlet></page-router-outlet>`
52
62
} )
53
- @RouteConfig ( [
54
- { path : '/main' , component : MainComponent , name : 'Main' , useAsDefault : true } ,
55
- { path : '/template' , component : AppComponent , name : 'Template' } ,
56
- { path : '/first' , component : FirstComponent , name : 'First' } ,
57
- { path : '/second' , component : SecondComponent , name : 'Second' } ,
58
- { path : '/router/...' , component : NavigationTestRouter , name : 'Router' } ,
59
- // { path: '/action-bar-test/...', component: ActionBarTest, name: 'ActionBar' },
60
- { path : '/first-action-bar' , component : FirstComponentActionBar , name : 'FirstActionBar' } ,
61
- { path : '/second-action-bar' , component : SecondComponentActionBar , name : 'SecondActionBar' } ,
62
- { path : '/binding' , component : BindingComponent , name : 'Binding' } ,
63
- { path : '/listView/commonTemplate' , component : ListViewComponent , name : 'ListView' } ,
64
- { path : '/listView/listViewMainPage' , component : ListViewMainPageComponent , name : 'ListViewMainPage' } ,
65
- { path : '/listView/customTemplate' , component : ListViewControlComponent , name : 'ListViewCustomTemplate' } ,
66
- { path : '/listView/asyncPipeTemplate' , component : ListViewAsyncPipeComponent , name : 'ListViewAsyncPipe' } ,
67
- { path : '/modal' , component : ModalTest , name : 'Modal' } ,
68
- { path : '/modal-on-push' , component : ModalTestWithPushStrategy , name : 'ModalWithPushStrategy' } ,
69
-
70
- ] )
71
- export class NavigationMainPageRouter { }
63
+ export class NavigationMainPageRouter { }
64
+
65
+
66
+ var routes : RouterConfig = [
67
+ { path : '' , component : MainComponent } ,
68
+ { path : 'template' , component : AppComponent } ,
69
+ { path : 'router' , component : NavigationTestRouter , children : NavigationSubRoutes } ,
70
+ { path : 'first' , component : FirstComponent } ,
71
+ { path : 'second' , component : SecondComponent } ,
72
+
73
+ { path : 'first-action-bar' , component : FirstComponentActionBar } ,
74
+ { path : 'second-action-bar' , component : SecondComponentActionBar } ,
75
+ { path : 'binding' , component : BindingComponent } ,
76
+
77
+ { path : 'listView' , component : ListViewMainPageComponent } ,
78
+ { path : 'listView/commonTemplate' , component : ListViewComponent } ,
79
+ { path : 'listView/customTemplate' , component : ListViewControlComponent } ,
80
+ { path : 'listView/asyncPipeTemplate' , component : ListViewAsyncPipeComponent } ,
81
+
82
+ { path : 'modal' , component : ModalTest } ,
83
+ { path : 'modal-on-push' , component : ModalTestWithPushStrategy } ,
84
+ ] ;
85
+
86
+ export var MainRouterProviders = nsProvideRouter ( routes , { enableTracing : true } ) ;
0 commit comments