ng-change get new value and original value

前端 未结 7 902
北荒
北荒 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:58

    With an angular {{expression}} you can add the old user or user.id value to the ng-change attribute as a literal string:

    
    

    On ngChange, the 1st argument to updateValue will be the new user value, the 2nd argument will be the literal that was formed when the select-tag was last updated by angular, with the old user.id value.

提交回复
热议问题