Skip to content

Commit 02808d1

Browse files
Include example for segmented bar
1 parent e2bfe78 commit 02808d1

File tree

4 files changed

+60
-13
lines changed

4 files changed

+60
-13
lines changed

app/app.routes.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ import { TabViewComponent } from "./tab-view/tab-view.component";
2929

3030
import { NavigationOptionsComponent } from "./navigation-options/navigation-options.component";
3131
import { NavigationInfoComponent } from "./navigation-options/navigation-info.component";
32+
33+
import { SegmentedBarMainPageComponent } from "./segmented-bar/segmented-bar-main-page.component"
34+
import { SegmentedBarIssue649Component } from "./segmented-bar/issue-649.component"
35+
3236
import { MainComponent } from "./main/main-page-router-outlet";
3337

3438
export const routableComponents = [
@@ -65,26 +69,28 @@ export const routableComponents = [
6569

6670
NavigationOptionsComponent,
6771
NavigationInfoComponent,
72+
SegmentedBarMainPageComponent,
73+
SegmentedBarIssue649Component,
6874
];
6975

7076
// Set isNavigatable: true if the page is a mian page to other sub pages
7177
export const routes = [
7278
{ path: '', component: MainComponent, data: { title: "" } },
7379
{ path: '', component: ModalContent, data: { title: "" } },
74-
{ path: 'template', component: AppComponent, data: { title: "Template", isNavigatable: true} },
80+
{ path: 'template', component: AppComponent, data: { title: "Template", isNavigatable: true } },
7581

76-
{ path: 'router', component: NavigationComponent, children: NavigationSubRoutes, data: { title: "Router", isNavigatable: true} },
77-
{ path: 'lazy-router', component: LazyNavigationComponent, data: { title: "Lazy Router", isNavigatable: true} },
82+
{ path: 'router', component: NavigationComponent, children: NavigationSubRoutes, data: { title: "Router", isNavigatable: true } },
83+
{ path: 'lazy-router', component: LazyNavigationComponent, data: { title: "Lazy Router", isNavigatable: true } },
7884

79-
{ path: 'first', component: FirstComponent, data: { title: "First", isNavigatable: true} },
80-
{ path: 'second', component: SecondComponent, data: { title: "Second", isNavigatable: true} },
85+
{ path: 'first', component: FirstComponent, data: { title: "First", isNavigatable: true } },
86+
{ path: 'second', component: SecondComponent, data: { title: "Second", isNavigatable: true } },
8187

82-
{ path: 'first-action-bar', component: FirstComponentActionBar, data: { title: "ActionBar1", isNavigatable: true} },
83-
{ path: 'second-action-bar', component: SecondComponentActionBar, data: { title: "ActionBar2", isNavigatable: true} },
88+
{ path: 'first-action-bar', component: FirstComponentActionBar, data: { title: "ActionBar1", isNavigatable: true } },
89+
{ path: 'second-action-bar', component: SecondComponentActionBar, data: { title: "ActionBar2", isNavigatable: true } },
8490

85-
{ path: 'binding', component: BindingComponent, data: { title: "Binding", isNavigatable: true} },
91+
{ path: 'binding', component: BindingComponent, data: { title: "Binding", isNavigatable: true } },
8692

87-
{ path: 'ListViewExamples', component: ListViewMainPageComponent, data: { title: "ListViewExamples", isNavigatable: true} },
93+
{ path: 'ListViewExamples', component: ListViewMainPageComponent, data: { title: "ListViewExamples", isNavigatable: true } },
8894
{ path: "ListViewExamples/commonTemplate", component: ListViewComponent, data: { title: "commonTemplate" } },
8995
{ path: "ListViewExamples/customTemplate", component: ListViewControlComponent, data: { title: "customTemplate" } },
9096
{ path: "listView/asyncPipeTemplate", component: ListViewAsyncPipeComponent, data: { title: "asyncPipeTemplate" } },
@@ -93,18 +99,21 @@ export const routes = [
9399
{ path: 'listPicker', component: ListPickerMainPageComponent, data: { title: "ListPicker", isNavigatable: true } },
94100
{ path: 'listPicker/list-picker', component: ListPickerComponent, data: { title: "ListPicker", isNavigatable: false } },
95101

96-
{ path: 'modal', component: ModalViewMainPageComponent, data: { title: "Modals", isNavigatable: true} },
102+
{ path: 'modal', component: ModalViewMainPageComponent, data: { title: "Modals", isNavigatable: true } },
97103
{ path: 'modal/modal-dialogs', component: ModalTest, data: { title: "modal" } },
98104
{ path: 'modal/modal-dialogs-push', component: ModalTestWithPushStrategy, data: { title: "modal(onPush)" } },
99105
{ path: 'modal/lazy', component: LazyLoadModalComponent, data: { title: "modal(lazy)" } },
100106

101107
{ path: 'tab-view', component: TabViewComponent, data: { title: "tab-view", isNavigatable: true } },
102108

103-
{ path: 'nav-options', component: NavigationOptionsComponent, data: { title: "nav-options", isNavigatable: true} },
109+
{ path: 'nav-options', component: NavigationOptionsComponent, data: { title: "nav-options", isNavigatable: true } },
104110
{ path: 'nav-info', component: NavigationInfoComponent, data: { title: "nav-info" } },
105111

112+
{ path: 'segmented-bar', component: SegmentedBarMainPageComponent, data: { title: "SegmentedBar", isNavigatable: true } },
113+
{ path: 'segmented-bar/issue-649', component: SegmentedBarIssue649Component, data: { title: "issue-649" } },
114+
106115
// Needed for AoT compilation
107-
{
116+
{
108117
path: "lazy",
109118
loadChildren: "./lazy/lazy.module#LazyModule"
110119
},

app/main/main-page-router-outlet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class MainComponent {
1515
private _orientation: string = "vertical";
1616

1717
constructor() {
18-
let navigatableRoutes = this._routes.filter((item) => {
18+
const navigatableRoutes = this._routes.filter((item) => {
1919
return item.data && item.data.isNavigatable && item.path;
2020
});
2121

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Component } from "@angular/core";
2+
import { SegmentedBar, SegmentedBarItem } from "ui/segmented-bar";
3+
4+
@Component({
5+
styles: ['#second { margin: 5; color: blue; background-color: yellow; font-weight: bold; font-size: 20; font-style: italic; font-family: monospace; height: 72; border-width: 2; border-radius: 7; border-color:green; selected-background-color: red; }'],
6+
template: `
7+
<StackLayout>
8+
<SegmentedBar selectedIndex="2" [items]="firstSegmentedBarItems" style="color: yellow; background-color: blue; font-weight: bold; font-size: 20; font-style: italic; font-family: monospace; selected-background-color: red;"></SegmentedBar>
9+
<SegmentedBar id="second" [items]="secondSegmentedBarItems" selectedIndex="2"></SegmentedBar>
10+
</StackLayout>
11+
`
12+
})
13+
export class SegmentedBarIssue649Component {
14+
public firstSegmentedBarItems: Array<SegmentedBarItem> = [];
15+
public secondSegmentedBarItems: Array<SegmentedBarItem> = [];
16+
17+
constructor() {
18+
for (let i = 1; i < 4; i++) {
19+
let segmentedBarItem = <SegmentedBarItem>new SegmentedBarItem();
20+
segmentedBarItem.title = "View " + i;
21+
this.firstSegmentedBarItems.push(segmentedBarItem);
22+
let segmentedBarItem1 = <SegmentedBarItem>new SegmentedBarItem();
23+
segmentedBarItem1.title = "View " + i * 2;
24+
this.secondSegmentedBarItems.push(segmentedBarItem1);
25+
}
26+
}
27+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Component } from "@angular/core";
2+
3+
@Component({
4+
selector: "main",
5+
template: `
6+
<StackLayout>
7+
<Button text="issue-649" [nsRouterLink]="['issue-649']"></Button>
8+
</StackLayout>
9+
`,
10+
})
11+
export class SegmentedBarMainPageComponent { }

0 commit comments

Comments
 (0)