I want to compare the old value with new value of input textbox of cellTemplate in ng-grid (AngularJS).
$scope.templateArray =[
{
field: "NP",
displayName: "Nameplate",
width: "*"
},
{
field: "Qty",
displayName: "Qty",
width: "30px",
cellTemplate: "<input ng-class=\"\'colt\' + col.index\" ng-input=\"COL_FIELD\" ng-model=\"COL_FIELD\" ng-model-options=\"{updateOn: 'default blur', debounce: {default: 0, blur: 0}, allowInvalid: false}\" ng-change=\"$scope.UpdateItemQty(row)\" />",
enableCellEdit: true
},
{
field: "NPPos15",
displayName: "Location",
width: "*"
}];
I tried two ways to achieve it, one using ng-change (in this case I always get new updated value) and second using AngularJS $watch (In this case I don't know what will be the $watch name). Suppose I use *$watch name "inputQty" then where I should use this name to link it with cell template of ng-grid (I tried putting it inside input textbox as id, but it did not work).
$scope.$watch('inputQty', function (newQty, oldQty) {
console.log('being watched oldValue:', oldValue, 'newValue:', newValue);
}, true);
How can I achieve it in ng-grid cellTemplate?