First of all
You can find here both are not same.
They are not the same, clearly. One is used solely in the controller; the other is a directive on an input element.
But even in their application they differ.
When you use $watch
the watched expression will be evaluated on every digest cycle, and if there is a change, the handler is invoked.
With ng-change
, the handler is invoked explicitly in response to an event.
With $watch
, change can come from anywhere: user action, controller function, service - all will trigger the handler.
With ng-change
, the change is restricted to a user action on a particular input element.
It is worth to note also that ng-change works only in combination with ng-model
- in other words, the ng-change expression is evaluated only when ngModel.$viewValue
(refer to ngModelController documentation for more info) is changed, which typically happens in response to a user-initiated event.
Second :
I don't think so you have to write 15 function just use one generic function like this
1st time call ng-change="triggerEvt('selectType1',value1)" ng-model="value1"
2nd time call ng-change="triggerEvt('selectType2',value2)" ng-model="value2"
where in case of select write code like this
1st select box <select ng-model="temp['selectType1']"></select>
2nd select box <select ng-model="temp['selectType2']"></select>
in case of controller write function like this
$scope.triggerEvt = function(type, value){
$scope.temp[type] = value;
}
PS name of the variables are for just example.Hope this helps.