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

ng-change trigger before model changed. #1741

Closed
imsingh opened this issue Jul 7, 2014 · 10 comments
Closed

ng-change trigger before model changed. #1741

imsingh opened this issue Jul 7, 2014 · 10 comments
Milestone

Comments

@imsingh
Copy link

imsingh commented Jul 7, 2014

Check the codepen http://codepen.io/imsingh/pen/nEaCo .

See the console. It shows wrong value in console.log when using ion-radio. It shows correct value with simple radio element.

ajoslin added a commit that referenced this issue Jul 11, 2014
Closes #1349, #1741

BREAKING CHANGE:

ion-toggle no longer has an isolate scope.
This will break your toggle only if you were relying upon the toggle
having an isolate scope: if you were referencing `$parent.value` as
the ng-disabled attribute, for example.

Change your code from this:

<ion-toggle ng-disabled="{{$parent.isDisabled}}"></ion-toggle>

To this:

<ion-toggle ng-disabled="{{isDisabled}}"></ion-toggle>
@ajoslin ajoslin closed this as completed Jul 11, 2014
@ajoslin
Copy link
Contributor

ajoslin commented Jul 11, 2014

Fixed. Thank you.

@iampeterbanjo
Copy link

I am not sure if this issue has been fixed. Please take a look at this codepen example - the value in the console does not match the value on the page

http://codepen.io/anon/pen/aIidC

@mhartington
Copy link
Member

I can confirm it is till broken in the nightly builds.

http://codepen.io/mhartington/pen/pItkL

@mhartington mhartington reopened this Jul 18, 2014
@zebulgar
Copy link

Just wanted to confirm that I've also just run across this. If pointed in the right direction I'd be happy to contribute to fix this!

@zebulgar
Copy link

This appears to be an issue in Angular?

angular/angular.js#4558

And here's a great example of it, watch the console logs:

http://plnkr.co/edit/Xe6ErQrg7WL6aAIoM9Gd?p=preview

@alexbainbridge
Copy link

Discussion around this on Stack Overflow too
http://stackoverflow.com/questions/24000647/ionic-toggle-returning-wrong-value

@adamdbradley adamdbradley added this to the 1.0.0-beta11 milestone Jul 28, 2014
@perrygovier
Copy link
Contributor

Is it just radio buttons? It looks like they weren't a part of @ajoslin's fix. I think they should be added so that none of our form element directives have an isolated scope. Note, this will be a big breaking change though. Maybe there's a simple temporary fix?

@alexbainbridge
Copy link

Hey @perrygovier this is still a problem with toggle (in 11). Looks like you just addressed radio? Would you prefer a new issue or to keep on this one?

@perrygovier
Copy link
Contributor

ion-toggle has the same fix I applied to ion-radio already in place. Mind creating a new ticket, since I'm not immediately sure what's causing it.

@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

8 participants