Skip to content
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

Toggle and checkboxes report incorrect value through ng-change. #1349

Closed
mattdennewitz opened this issue May 12, 2014 · 5 comments
Closed

Toggle and checkboxes report incorrect value through ng-change. #1349

mattdennewitz opened this issue May 12, 2014 · 5 comments

Comments

@mattdennewitz
Copy link

<ion-toggle> and <ion-checkbox> elements incorrectly report their state when state is accessed through $scope in an ng-change callback. It appears that they're returning their pre-transition state.

This behavior can be seen in action here: http://plnkr.co/edit/ImILoeeGWHQ2Zpw9uWkl?p=preview

Values seen in ng-click callbacks are correct.

@sashock
Copy link

sashock commented Jul 6, 2014

Hello guys, it seems that the issue is still present with ion-toggle:
see this plunkr :
http://plnkr.co/edit/SEUVuIxsL81awM3OXlbr

with ion-toggle the ng-change callback has the old value in the scope whereas the ion-checkbox has the correct behaviour

@c0bra
Copy link

c0bra commented Jul 10, 2014

👍 it does indeed appear that in 1.0.0-beta.8 ng-change is being evaluated before the model is updated.

I am ugly-hacking-ly getting around it by wrapping the inside of my change handler in a $timeout; it will be nice to have the fix in the next release.

@ajoslin
Copy link
Contributor

ajoslin commented Jul 10, 2014

Looking at this again asap.

@ajoslin
Copy link
Contributor

ajoslin commented Jul 11, 2014

Fixed toggle via 537b29d the same way checkbox was fixed in a006d89.

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 6, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants