You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
input: ng-messages do not work if animation is disabled #10240
<formname="f"><md-input-containerclass="md-block"><label>Some text</label><inputtype="text" name="i" placeholder="Enter something" required/><divng-messages="f.i.$error"><divng-message="required">This field is required.</div></div></md-input-container></form>
Everything works -- tab in to the field, tab out, and the field behaves as expected. Specifically:
The placeholder text "Enter something" appears in red.
The form field is underlined in red.
The text "This field is required." appears underneath the field.
However, if your app turns off animation by, for example, injecting a $animate instance and calling $animate.enabled(false), (1) and (2) still occur, but (3) no longer happens -- the ng-message does not appear.
Details: That codepen is identical to the one at https://material.angularjs.org/latest/demo/input (the "Errors Advanced" section). All I've done is change the controller to inject $animate, set $scope.showHints = false, and then called $animate.enabled(false);.
If you change that to $animate.enabled(true) the errors will start appearing again.
@nikclayton Correct. I'm the process of moving the animations to pure CSS. It just needs more testing but I'll probably have it ready for today.
The reason why we moved to $animate was due to a flicker bug. We can now move back to CSS because of the newer ng-enter-prepare class that was added since.
I've removed the has: Pull Request label because the PR didn't account for many instances. I think we should just check if animation is enabled and if not, call element.addClass(). I will look into this soon.
changed the title [-]ng-messages + ngmaterial 1.1 do not work if animation is disabled[/-][+]input: ng-messages do not work if animation is disabled[/+]on Feb 12, 2019
Activity
nikclayton commentedon Jan 10, 2017
Suspect that cf7f21a is the culprit, which unconditionally uses $animate() to add new classes instead of checking to see if animation is enabled.
clshortfuse commentedon Jan 10, 2017
@nikclayton Correct. I'm the process of moving the animations to pure CSS. It just needs more testing but I'll probably have it ready for today.
The reason why we moved to $animate was due to a flicker bug. We can now move back to CSS because of the newer ng-enter-prepare class that was added since.
fix(input): move messages animations back to CSS
fix(input): move messages animations back to CSS
fix(input): move messages animations back to CSS
fix(input): correct initial animation state of messages
fix(input): correct initial animation state of messages
topherfangio commentedon Mar 20, 2017
I've removed the
has: Pull Requestlabel because the PR didn't account for many instances. I think we should just check if animation is enabled and if not, callelement.addClass(). I will look into this soon.10 remaining items
[-]ng-messages + ngmaterial 1.1 do not work if animation is disabled[/-][+]input: ng-messages do not work if animation is disabled[/+]Splaktar commentedon Feb 12, 2019
I updated the CodePen to
1.1.12and it appears to be working properly. It looks like this was fixed indirectly already.clshortfuse commentedon Feb 12, 2019
Looks like it was fixed in 0151b4b
The commit didn't closed the issue. I'm not entirely sure why.
Splaktar commentedon Feb 12, 2019
@clshortfuse thank you! It didn't close it because you need a
Fixesfor each issue #. I.e.Fixes #. Fixes #.