Skip to content

Niliev/tab #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
<!-- >> binding-tab-view-html -->
<TabView [(ngModel)]="tabSelectedIndex" selectedColor="#FF0000" iosIconRenderingMode="alwaysOriginal" sdkExampleTitle sdkToggleNavButton>
<StackLayout *tabItem="{title: 'Profile', iconSource: 'res://icon'}" >
<ListView [items]="items">
<ng-template let-item="item">
<Label [text]="item.itemDesc"></Label>
</ng-template>
</ListView>
<StackLayout *tabItem="{title: 'Profile', iconSource: 'res://icon'}">
<StackLayout>
<Label [text]="'Profile Tab (tabSelectedIndex = '+ tabSelectedIndex +')'" class="h2 m-t-16 text-center" textWrap="true"></Label>
<Button text="Change Tab via ngModel" (tap)="changeTab()" class="btn btn-primary btn-active"></Button>
</StackLayout>
</StackLayout>
<StackLayout *tabItem="{title: 'Stats'}">
<Label text="Second tab item"></Label>
<StackLayout>
<Label [text]="'Stats Tab (tabSelectedIndex = '+ tabSelectedIndex +')'" class="h2 m-t-16 text-center" textWrap="true"></Label>
<Button text="Change Tab via ngModel" (tap)="changeTab()" class="btn btn-primary btn-active"></Button>
</StackLayout>
</StackLayout>
<StackLayout *tabItem="{title: 'Settings'}">
<Label text="Third tab item"></Label>
<StackLayout>
<Label [text]="'Settings Tab (tabSelectedIndex = '+ tabSelectedIndex +')'" class="h2 m-t-16 text-center" textWrap="true"></Label>
<Button text="Change Tab via ngModel" (tap)="changeTab()" class="btn btn-primary btn-active"></Button>
</StackLayout>
</StackLayout>
</TabView>
<!-- << binding-tab-view-html -->
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
// >> binding-tab-view-code

import { Component } from "@angular/core";
import { StackLayout } from "ui/layouts/stack-layout";

import { TabView, SelectedIndexChangedEventData, TabViewItem } from "ui/tab-view";

export class DataItem {
constructor(public itemDesc: string) {}
constructor(public itemDesc: string) { }
}

@Component({
moduleId: module.id,
templateUrl: "./binding-tab-view-items.component.html",
})
export class BindingTabViewItemsComponent {
public items: Array<DataItem>;
// >> binding-tab-view-code
public tabSelectedIndex: number;

constructor() {
this.tabSelectedIndex = 1;
this.items = new Array<DataItem>();
for (let i = 0; i < 5; i++) {
this.items.push(new DataItem("item " + i));
}

changeTab() {
if (this.tabSelectedIndex === 0) {
this.tabSelectedIndex = 1;
} else if (this.tabSelectedIndex === 1) {
this.tabSelectedIndex = 2;
} else if (this.tabSelectedIndex === 2) {
this.tabSelectedIndex = 0;
}
}
// << binding-tab-view-code
}
// << binding-tab-view-code