-
Notifications
You must be signed in to change notification settings - Fork 3.4k
md-input-container not showing error ng-messages #6767
Comments
update: codepen +1 - I am doing custom messaging for server-side errors with ng-messages using an
This code worked with v0.11, but no longer works after bumping to 1.0. Looking into the DOM on the rendered page, the class |
@keithajackson, did you add some custom code to fix this? |
@vilo20 I was hoping to avoid it, but it's looking like I have to override a CSS style to make a workaround: The offending rules (which are getting applied to the md-input-container .md-auto-hide .md-input-message-animation:not(.ng-animate) {
opacity: 0;
margin-top: -100px;
}
md-input-container:not(.md-input-invalid) .md-auto-hide .md-input-message-animation {
opacity: 0;
margin-top: -100px;
} |
update: codepen with fix GOT IT. I needed to disable auto-hiding on my
to
The md-input docs note that messages will automatically be hidden until the |
Workaround: I made a somewhat fixed codepen off your issue, @vlio20 , by handling the visibility myself: <div ng-messages="registrationForm.agencyName.$error" md-auto-hide="false" ng-if="registrationForm.agencyName.$touched"> The animations get weird, though when I follow the steps to reproduce. Both errors become visible for a moment, and then the minlength error disappears without an animation. |
@keithajackson, yea it worked! thanks!!! I think it should be the default behavior. Thanks @keithajackson, I will close this issue. |
@vlio20 I think we should keep this open. The workaround fix still results in broken animations, so I think the underlying feature has a bug. Open codepen, then:
|
Hi guys, thanks for the workaround. Keep the issue open I just ended up here having the same problem as you guys. Lets hope for a real fix soon that will also fix the animation. |
A full, valid PR would be welcomed. |
Based on this conversation, ng-messages are effectively not working with angular material? Is that what I'm seeing? |
You are right. It's not even an edge case |
+1 |
9 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
Currently we only check for the `md-input-invalid` class, but that won't work, because if you're input is already invalid, and another invalid criterium appears, then we can't detect the difference. The input container still thinks, it's only one message, from the start. Fixes angular#6767. Fixes angular#6399. References angular#6443.
+1 |
With commit cf7f21a, animations were moved to input.js in response to an ng-enter flicker issue with Angular 1.4.x. While the flicker was fixed, new animation bugs arised. Angular 1.4.x added and backported a ng-enter-prepare to avoid this bug. * Remove JS animations for input messages * Use `.ng-enter-prepare` to avoid flicker on Angular 1.4+ * Use `.ng-enter:not(.ng-enter-active)` to prepare animations on 1.3+ and below * Update spec tests to use getComputedStyle instead of ngAnimate Fixes #6767, #9543, #9723, #10240 Related: angular/angular.js#13408
With commit cf7f21a, animations were moved to input.js in response to an ng-enter flicker issue with Angular 1.4.x. While the flicker was fixed, new animation bugs arised. Angular 1.4.x added and backported a ng-enter-prepare to avoid this bug. * Remove JS animations for input messages * Use `.ng-enter-prepare` to avoid flicker on Angular 1.4+ * Use `.ng-enter:not(.ng-enter-active)` to prepare animations on 1.3 and below * Update spec tests to use getComputedStyle instead of ngAnimate Fixes #6767, #9543, #9723, #10240 Related: angular/angular.js#13408
With commit cf7f21a, animations were moved to input.js in response to an ng-enter flicker issue with Angular 1.4.x. While the flicker was fixed, new animation bugs arised. Angular 1.4.x added and backported a ng-enter-prepare to avoid this bug. * Use `.ng-enter-prepare` to avoid flicker on Angular 1.4+ * Use `.ng-enter:not(.ng-enter-active)` to prepare animations on 1.3 and below Fixes #6767, #9543, #9723, #10240 Related: angular/angular.js#13408
With commit cf7f21a, animations were moved to input.js in response to an ng-enter flicker issue with Angular 1.4.x. While the flicker was fixed, new animation bugs arised. Angular 1.4.x added and backported a ng-enter-prepare to avoid this bug. * Use `.ng-enter-prepare` to avoid flicker on Angular 1.4+ * Use `.ng-enter:not(.ng-enter-active)` to prepare animations on 1.3 and below * Update spec tests to use computedStyle Fixes #6767, #9543, #9723, #10240 Related: angular/angular.js#13408
+1 |
????? |
Hi guys! I have another scenario where the message doesn't works... In debbuging I saw that line on code: material/src/components/input/input.js Line 1020 in e06284a
and don't know why the md-input-container haven't the class "md-input-invalid". That behavior is expected? An exemple: |
@mikila85 Are you still having issues? If so, please provide a Codepen so that we can investigate. @rafaeldev It looks like the |
don't get this warning when you remove the
attribute in the $mdAtuocomplete |
@offwork What warning? Can you elaborate? |
@topherfangio Thanks for reply e for help me! |
I have a similar problem with firefox 52.0 on ubuntu, Chrome is fine. See http://codepen.io/anon/pen/vxRpJK the error shows then disappears. |
Is this still an issue? there's no fix for this? |
Its a bit of a pain but I found it best just to not use ng-message for server side errors in this case, I just use a loop/switch to display them styled the same way... similar to the way the document say's to display info underneath |
@jellyfush Do you have an example of that? The problem is that I'm using ng-message, I don't understand why those messages work on the login example and not over the rest of the pages.. Thanks |
@bruno-serfe Yea its kind of frustrating. Seems like some weird thing with the animation setting the opacity to 0 when finishing, could actually be an angular bug but haven’t looked into it enough. If you wanted to do something similar to the ng-message you could reference this https://codepen.io/anon/pen/dRwXQE you could put a switch in there to render the message the way you want. Seems like a bit of an ugly hack, but works form me. Of course if you were getting errors back from the server I would remove the ng-if and just have it print the returned error. Can be used in combination with ng-message but it looks as though only one can be active at a time otherwise they sit on top of each other |
I also faced the issue. If I set the form's name with dash character "-", then it didn't show the error message. However, when I changed to camel case, it's okay. |
I had a similar problem. As it turned out, one form was inside another one. Check your page layout |
I have finally found a solution that works for me with the help of @topherfangio |
Hi,
There are cases when the error message (ng-message) not showing, try to play with the codepen below.
the input field is required and minlength set to 2:
http://codepen.io/vlio20/pen/KVybvx?editors=110
Steps to reproduce:
Note-1: The form is invalid with correct message
Note-2: in happens for other validations as well (other then required and minlength).
If I am overriding the styles like bellow, it seems to be working, but the animations are not good when the error message is changed:
I am using 1.0.2 version, but it seems to be broken since 1.0.0
The text was updated successfully, but these errors were encountered: