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
md-select with ngModel requires name attribute (hasValue error) #5402
Comments
It works fine here without the name attribute. Can you reveal more about your setup? As a note: Typescript 2.2 is required (not sure if it's noted anywhere in the docs or is relevant here) |
The name requirement on elements with |
ah yes, can that be outlined in the guide? I would guess it's a common use case |
I'd say the message is helpful enough since it gives an example of how to solve the error. I'll submit a fix so Material doesn't throw any extra errors that may cause confusion. |
If the user has an `md-select` with an `ngModel` that doesn't have a name inside a form, the forms module will throw an error, however Material will also start throwing errors, which may cause confusion. These changes add a null check so our errors don't get mixed up with the forms error. Fixes angular#5402.
If the user has an `md-select` with an `ngModel` that doesn't have a name inside a form, the forms module will throw an error, however Material will also start throwing errors, which may cause confusion. These changes add a null check so our errors don't get mixed up with the forms error. Fixes angular#5402.
If the user has an `md-select` with an `ngModel` that doesn't have a name inside a form, the forms module will throw an error, however Material will also start throwing errors, which may cause confusion. These changes add a null check so our errors don't get mixed up with the forms error. Fixes angular#5402.
If the user has an `md-select` with an `ngModel` that doesn't have a name inside a form, the forms module will throw an error, however Material will also start throwing errors, which may cause confusion. These changes add a null check so our errors don't get mixed up with the forms error. Fixes #5402.
#5405) If the user has an `md-select` with an `ngModel` that doesn't have a name inside a form, the forms module will throw an error, however Material will also start throwing errors, which may cause confusion. These changes add a null check so our errors don't get mixed up with the forms error. Fixes #5402.
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. |
Bug, feature request, or proposal:
This is a bug with the documentation not matching expected behaviour
What is the expected behavior?
No error when copying guide code
What is the current behavior?
You get an error:
MdSelect.html:1 ERROR TypeError: Cannot read property 'hasValue' of undefined
at Object.View_MdSelect_0.co [as updateDirectives]
What are the steps to reproduce?
Following the guide, and copying example code should render without errors:
https://material.angular.io/components/select/overview
What is the use-case or motivation for changing an existing behavior?
The error is not useful, also modifying the example code, adding a name attribute to the md-select element fixes the issue:
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 4.0.2
Angular Material 2.0.0-beta.7
MacOS 10.12.5
TypeScript 2.0.0
Chrome 59.0.3071.109
Is there anything else we should know?
The other example is correct here:
https://material.angular.io/components/select/examples
The text was updated successfully, but these errors were encountered: