-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
CdkStepper error when binding to selectedIndex #8031
Comments
I'll try to work up a pull request for this, seems pretty simple. |
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Oct 25, 2017
Fixes an error that is thrown if the `selectedIndex` is set before the steps are initialized. Fixes angular#8031.
andrewseguin
pushed a commit
that referenced
this issue
Nov 2, 2017
Fixes an error that is thrown if the `selectedIndex` is set before the steps are initialized. Fixes #8031.
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug, feature request, or proposal:
Bug
What is the expected behavior?
Since there is not currently a responsive stepper, I'm working with hiding/showing vertical and horizontal steppers based on the viewport size. When the viewport resizes and the steppers are swapped out, I need to set the selected index on the stepper that is coming into view. I'm doing that by listening to
selectionChange
event on the stepper, storing the index (defaulting to 0), and binding to it on both steppers.What is the current behavior?
When Angular creates the stepper the first time, the bound index is set to 0. The CdkStepper
set selectedIndex
function is calling_anyControlsInvalid()
, which has a NPE when checking for steps that have not yet been created:What are the steps to reproduce?
https://stackblitz.com/edit/angular-material2-issue-ggc2sf
Error shows in console
What is the use-case or motivation for changing an existing behavior?
I can see additional uses for binding to selectedIndex, for example if you already know the user has completed some steps and you want to start them further along.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Material beta 12
Is there anything else we should know?
The text was updated successfully, but these errors were encountered: