Material: ngMessages disappear using Angular Material

Created on 3 Jun 2016  路  7Comments  路  Source: angular/material

There seems to be a bug in angular material causing the ng-messages to disappear in an unexpected way.

Applying ng-messages and validation to a form, the error messages do not show up properly when both required and minlength are set. The user remains confused about why his input is invalid.

Plunker:
https://plnkr.co/edit/7omwpbT3Y5h9VoasVMX4?p=preview

steps to reproduce:

  • focus and unfocus the field, "required" pops up
  • enter "abcde", "required" disappears, but the field stays invalid until "e" (minlength=5) is entered. The minlength message is NOT showing up to indicate why the input is invalid
  • delete "e", now the minlength message appears, as ist should
  • delete the rest, the "required" message does NOT show up.
  • "required" will only show up if entering and deleting the whole string at once (select all, delete)
  • disable angular material and it works as expected

Angular Versions:

  • Angular Version: 1.5.6
  • Angular Material Version: 1.1.0-rc2

Additional Information:

  • Browser Type: Firefox
  • Browser Version: 46.0.1
  • OS: Windows 7

Most helpful comment

+1
It seems this does not only happen with requried and minlength. For me it happened with required and email. I assume it'll happen with any combination of validation messages.

@ThomasBurleson Also seems to me this is a huge use case. Don't know how this can be placed in Backlog...

@topherfangio Is there progress on this?

All 7 comments

Looks like it is fixed in 1.1.0-RC5. See the Errors input demo on Angular-Material website. The last field has multiple error cases.

The problem is not about multiple error cases but especially the combination of minlength and required.
However, I figured out from that demo the attribute md-auto-hide is set to false for ng-messages, that did the job for my problem for now... it's still just a workaround, though.

@ThomasBurleson I also had a PR for that, but @topherfangio said, that he is already working on that.

@ThomasBurleson @DevVersion Indeed I have a branch that fixes it, but we were debating whether or not to use Protractor or Karma to write the necessary tests. Did we ever come to a conclusion on that?

Karma is preferred since we really do not have Protractor tests configured and I am not sure we want to open that "pandora box"

@ThomasBurleson Let me reference my PR (#7583) here, so we can take a look at a possible fix.

@topherfangio Cool looking forward seeing the tests :smile: . When can we expect to see some changes?

+1
It seems this does not only happen with requried and minlength. For me it happened with required and email. I assume it'll happen with any combination of validation messages.

@ThomasBurleson Also seems to me this is a huge use case. Don't know how this can be placed in Backlog...

@topherfangio Is there progress on this?

Was this page helpful?
0 / 5 - 0 ratings