forked from NativeScript/nativescript-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle-page-main.component.ts
35 lines (31 loc) · 1.07 KB
/
single-page-main.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
import {Router} from "@angular/router";
import {Component, ElementRef} from "@angular/core";
import {Location, LocationStrategy} from "@angular/common";
import {FirstComponent} from "./first.component";
import {SecondComponent} from "./second.component";
@Component({
selector: "single-page-main",
template: `
<ListView [items]="['lqlq', 'shalqlq']" class="list-group">
<ng-template let-item="item" let-odd="odd" let-even="even">
<StackLayout>
<Label [text]="item" class="list-group-item"></Label>
</StackLayout>
</ng-template>
</ListView>
<Label text="Single-page router"></Label>
<router-outlet></router-outlet>
`
})
export class SinglePageMain {
constructor(
public elementRef: ElementRef,
public router: Router,
public location: LocationStrategy) {
}
}
export const routes = [
{ path: "", redirectTo: "first/single-page", pathMatch: "full", terminal: true },
{ path: "first/:id", component: FirstComponent },
{ path: "second/:id", component: SecondComponent },
];