-
-
Notifications
You must be signed in to change notification settings - Fork 241
[(ngModel)]="selectedIndex" not working in TabView #551
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
Comments
Same here. I'm struggling with this for hours now =/ |
I Confirm this issue! First, I've tried to set a name, like so: So I got the error:
Then, I've tried to set ngDefaultControl: <TabView ngDefaultControl name="tabname"` No errors, but the |
It seems be related to #525 as I'm testing on iOS as well. |
I've tried to implement using Nativescript <GridLayout>
<TabView (loaded)="onTabViewLoaded($event)">
<template tabItem title="Tab A">
<StackLayout>
<label text="Tab A {{selectedIndex}}"></label>
</StackLayout>
</template>
<template tabItem title="Tab B">
<StackLayout>
<label text="Tab B {{selectedIndex}}"></label>
</StackLayout>
</template>
<template tabItem title="Tab C">
<StackLayout>
<label text="Tab C {{selectedIndex}}"></label>
</StackLayout>
</template>
</TabView>
</GridLayout> import { Component } from '@angular/core';
import { TabView, SelectedIndexChangedEventData } from "ui/tab-view";
@Component({
selector: 'tabs',
templateUrl: 'app/tabs.html'
})
export class Home {
public selectedIndex: number = 0;
onSelected(newIndex) {
console.log('this.selectedIndex.before', this.selectedIndex); // correct
this.selectedIndex = newIndex;
console.log('this.selectedIndex.after', this.selectedIndex); // correct
}
onTabViewLoaded(args) {
let customTabview = args.object;
let self = this;
customTabview.on(TabView.selectedIndexChangedEvent, (args: SelectedIndexChangedEventData) => {
console.log('oldIndex', args.oldIndex);
console.log('newIndex', args.newIndex);
self.onSelected(args.newIndex);
});
}
} The interesting is that the I'm trying to find a way out to convert |
This turns out to be a bug in the value accessor implementation. The fix should land on master sometime tomorrow. |
Can't believe adding a single comma fixes that. I've tried so many other ways LOL! |
PS: We need to make sure we import |
( selectedIndex = 0 is defined in the component)
The text was updated successfully, but these errors were encountered: