Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Javascript animations broken using angular 1.3.x and form with required fields #9886

Closed
chatellier opened this issue Nov 3, 2014 · 8 comments

Comments

@chatellier
Copy link

I'm trying to update a working application from angularjs 1.2.26 to 1.3.1.
This application uses javascript animation based on jquery animations.

There is maybe a problem using this animation on a form containing required fields.

This can been seen in following fiddle : http://jsfiddle.net/myj3G/17/

This issue is related to previous issue #6536. This issue contains a workarround that doesn't work anymore.

@caitp
Copy link
Contributor

caitp commented Nov 3, 2014

looks to me like the only problem is that you're expecting the className to be an exact match --- http://jsfiddle.net/3tswxf13/ this is working fine

@chatellier
Copy link
Author

This is still not working.
Each click on button should display or hide form.
Your change just hide form but does not display it again on next click.

@caitp
Copy link
Contributor

caitp commented Nov 3, 2014

that depends entirely on the evaluation of ng-hide, nothing else

@chatellier
Copy link
Author

I don't understand. Is there a way to fix animation (both slide up AND slide down) ?
Or my code is not properly writen ?

@chatellier
Copy link
Author

This seams to be a problem related to required fields.

In following fiddle: http://jsfiddle.net/myj3G/18/ if ng-form is not on the same element as ng-show, it's works fine.

@caitp
Copy link
Contributor

caitp commented Nov 3, 2014

@chatellier I was wrong --- the problem wasn't even that you were abusing ngAnimate's api, it was that you were trying to assign values to properties of a boolean, which doesn't really work in JS. Changing your model and required expression to point to something which can actually take properties fixes it:

http://jsfiddle.net/vr2a9kuo/

@caitp
Copy link
Contributor

caitp commented Nov 3, 2014

I'm not sure why ng-required="foo" isn't working, that deserves some investigation

@caitp caitp reopened this Nov 3, 2014
@jeffbcross jeffbcross added this to the 1.3.x milestone Nov 11, 2014
@jeffbcross jeffbcross self-assigned this Nov 11, 2014
@jeffbcross jeffbcross removed their assignment Nov 11, 2014
@petebacondarwin
Copy link
Member

The bug with foo was that multiple classes were being added or removed at the same time. So the value passed to beforeAddClass and removeClass looked like: ng-valid ng-valid-required ng-hide.
Using a regular expression to match the class solves the problem: http://jsfiddle.net/peLe9hj8/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants