-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
[Tabs] Two-way binding for tabs only work on initializing component #1692
Comments
is this in progress? if not I can take it. thanks |
The issue with the plunkr example is that the tab is added after the setter for the selectedIndex kicks in so the setter becomes invalid. Any hint how to work around this? One idea I got is to save save the selectedIndex value and when the tab is added set it again. what do you think? thanks. |
@jelbourn @andrewseguin you want me to take this one? thanks |
@krigton: @andrewseguin is going to tackle this one |
@jelbourn oki. i tackled a bit myself that's why i asked. any other issue you want me to address? thanks |
I've been looking into this and the issue can be resolved easily but we are running into a problem of syncing the animiations correctly. Will spend some more time on this today to see if we can come up with an ideal solution. |
What you mean by synching the animations correctly? |
When a selection is made, it may be on a new tab. Often we'll see someone add a tab to their list of tabs and immediately want to select it. In this case, we want to have it animate it in from the left or right. Went through many iterations until I figured out how to do this. The difficult part is that the selectedIndex setter is handled by angular before the view's tabs are updated. |
Still having this issue on beta2, beta3 won't build in webpack for me. Is there any workaround for this? Currently can't find any way to set selected tab programmatically which is frankly unacceptable for a tab control! |
Same thing here :/ Edit : using master (02/05/2017) EDIT 2 : PTC-JoshuaMatthews : it works using plain old |
I am on "@angular/material": "2.0.0-beta.2", Using plain old [(selectedIndex)] does not work for me. Regardless of what it is set to the tab starts on the first tab. Right now have a hacky way of getting it done with a timeout that looks terrible. setTimeout(() => { Why would my selected index binding not work the way you describe? |
@PTC-JoshuaMatthews : Not sure what you are trying to do. Here, my component has a class property
Then, my template uses I hope it will help you :) |
@AlanCrevon I am just demonstrating what I have to go through to use selectedIndex. I can set it after waiting for the control to instantiate (with the timeout) through a ViewChild instance. Binding to it the way you are describing is not working for me, the control ignores it. |
@PTC-JoshuaMatthews sorry mate. Don't know how to help, then. :/ |
Would it be possible to get the material documentation (link below) updated for tabs, to include an example of programmatically setting the selected index? The plunkr referenced above no longer works. |
is this issue fixed? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
What is the expected behavior?
When changing the variable bind to selectedIndex, the active tab should change.
What is the current behavior?
The active tab stays the same.
What are the steps to reproduce?
http://plnkr.co/edit/cX9OKA?p=preview
Which versions of Angular, Material, OS, browsers are affected?
@angular : 2.0.0
@angular/material : 2.0.0-alpha.9-3
Windows 7
The text was updated successfully, but these errors were encountered: