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
fix(select): throwing additional errors if ngModel fails to initialize #5405
Conversation
src/lib/select/select.spec.ts
Outdated
const fixture = TestBed.createComponent(InvalidSelectInForm); | ||
|
||
// The first change detection run will throw the "ngModel is missing a name" error. | ||
expect(() => fixture.detectChanges()).toThrow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you pass a regex to toThrowError
to check which specific error is being thrown here?
src/lib/select/select.spec.ts
Outdated
expect(() => fixture.detectChanges()).toThrow(); | ||
|
||
// The secound run shouldn't throw selection-model related errors. | ||
expect(() => fixture.detectChanges()).not.toThrow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: secound
-> second
4635ac1
to
0e86fec
Compare
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.
0e86fec
to
4ea52e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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. |
If the user has an
md-select
with anngModel
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.