mardi 4 août 2015

Angular: Control that fired ng-change

I have an Angular form that has several input boxes that I want to validate, using a generic JS function but need to know the control that fired the event so certain rules can be applied.

(Simplified code)

<input ng-model="Field1" ..... ng-change="validateMe()" />
.
.
<input ng-model="FieldX" ..... ng-change="validateMe()" />

$scope.validateMe = function() {
   // get the text of the control that fired the event

   // do the validation 

   // update something else if valid value given

}

I know that ng-click has the $event, but how can I do it from an ng-change



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire