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 Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Function in ng-change is fired before input is touched. #9867
Today I wanted to "upgrade" to 1.3.1.
Every piece of my app is working but ng-change not anymore.
My function "showPriority()" is called when template is rendering as many times as is items in an object speakers (deferred ajax result from laravel api).
It was working fine (function is called only when I will change the value of input) in 1.3.0-beta.19, but not in 1.3.0-rc.0+ (for 4 items is called 4x, when i will change the value +1x...).
Hi! It's halloween, terrible time to be filing bugs! (kidding, kidding). Could you post a quick reproduction of this on https://plunkr.co? That would be super helpful.
Hello Caitlin,
I debugged my code and I found out where is the problem.
It's input attribute maxlength. With maxlength="1" is function change() fired without touch.
It seems to be related to the input value not being a string, actually --- I can't reproduce if the value is a string to begin with. So what we're doing is, we're converting to a string to validate maxlength, and the model value is changing too because of this.
Activity
caitp commentedon Nov 1, 2014
Hi! It's halloween, terrible time to be filing bugs! (kidding, kidding). Could you post a quick reproduction of this on https://plunkr.co? That would be super helpful.
JonasJonny commentedon Nov 1, 2014
Hello Caitlin,
I debugged my code and I found out where is the problem.
It's input attribute maxlength. With maxlength="1" is function change() fired without touch.
Here is plunker http://plnkr.co/n1Iq5uhYog23022Cfvxc
Narretz commentedon Nov 1, 2014
Might be related to #9063
caitp commentedon Nov 4, 2014
It seems to be related to the input value not being a string, actually --- I can't reproduce if the value is a string to begin with. So what we're doing is, we're converting to a string to validate maxlength, and the model value is changing too because of this.
I'll see if I can make a patch for it
fix(input): don't invoke viewChangeListeners before real user input
frfancha commentedon Nov 7, 2014
This is a terrible issue for us because every number is changed in string before we have set the parser.
We have to stay in 1.2 until it is fixed.
Narretz commentedon Nov 23, 2014
This is going to be fixed in 1.3.4, see e3764e3