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

ie9: Placeholder displayed instead ng-model value when ng-model value set later in same digest cycle. #26

Closed
acidaris opened this issue Jun 17, 2015 · 3 comments
Labels

Comments

@acidaris
Copy link

If the ng-model value is initialized after the placeholder directive (but in the same digest cycle), the value is hidden, and the placeholder is displayed instead.

see https://jsfiddle.net/7arxneod/6/ If you watch closely, the value will flicker between the expected value ($1.00) and 'placeholder' in ie9.

The issue seems to be the initialization of the placeholder. Since the placeholder directive's link function executes first, updateValue() will update the elements value in the next digest cycle to an empty string.

When the other directives link function initializes the value, the $render() function will correctly set the element's value, but because updateValue() uses $timeout, the displayed value is overridden in the next digest cycle.

@cvn cvn added the bug label Jun 17, 2015
@cvn
Copy link
Owner

cvn commented Jun 18, 2015

Hey @acidaris I can confirm this bug. Your deduction was correct. That $timeout you mentioned is part of a workaround for a bug in angular core where tabbing out of an input triggers a delayed update to the model.

I've got a fix working locally. I updated updateValue() so that it's smarter about when it uses $timeout. I'll push this soon.

cvn added a commit that referenced this issue Jun 18, 2015
@cvn cvn closed this as completed in d269f84 Jun 18, 2015
@cvn
Copy link
Owner

cvn commented Jun 18, 2015

Hey @acidaris I pushed the fix and released a new version. The fiddle works perfectly for me in IE9 now. Let me know if you have any other issues.

@acidaris
Copy link
Author

thanks, works great.

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

No branches or pull requests

2 participants