ng-change get new value and original value

前端 未结 7 893
北荒
北荒 2020-11-28 22:20

I\'m using ng-options to select values from a pulldown. I\'d like to be able to compare the old value to the new value. ng-change works well for grabbing the new value of th

7条回答
  •  春和景丽
    2020-11-28 22:43

    Just keep a currentValue variable in your controller that you update on every change. You can then compare that to the new value every time before you update it.'

    The idea of using a watch is good as well, but I think a simple variable is the simplest and most logical solution.

提交回复
热议问题