Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
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

Closed

Description

@JonasJonny

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...).

Is there any difference in ngChange?

<div data-ng-repeat="item in speakers | orderBy:sortBy:reverse">
  <input type="text" data-ng-model="item.priority" data-ng-change="showPriority()">
</div>

Activity

  1. caitp commented on Nov 1, 2014

    @caitp
    Contributor

    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.

  2. added this to the 1.3.2 milestone on Nov 1, 2014
  3. JonasJonny commented on Nov 1, 2014

    @JonasJonny
    Author

    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

  4. Narretz commented on Nov 1, 2014

    @Narretz
    Contributor

    Might be related to #9063

  5. caitp commented on Nov 4, 2014

    @caitp
    Contributor

    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

  6. added a commit that references this issue on Nov 4, 2014
    7480f43
  7. frfancha commented on Nov 7, 2014

    @frfancha

    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.

  8. modified the milestones: 1.3.2, 1.3.3 on Nov 7, 2014
  9. modified the milestones: 1.3.3, 1.3.4 on Nov 17, 2014
  10. Narretz commented on Nov 23, 2014

    @Narretz
    Contributor

    This is going to be fixed in 1.3.4, see e3764e3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions