Answer the question
In order to leave comments, you need to log in
How to dynamically copy the value of a field in AngularJS to another field with a filter?
Good afternoon. There is such task:
The user enters value into a text box. The field is described by the $scope.field model.
The value of the other field is updated dynamically, with the value of $scope.field_t updated and the filter somefilter applied. In this case, you cannot use hard bindings to model properties, because the fields can be different, and this behavior is specified in the template.
For example like this:
<input name="master" type="text" ng-model="$socpe.field" />
<input name="slave" type="text" ng-model="$socpe.field_t" />
<input name="master" type="text" ng-model="$socpe.field" />
<input name="slave" type="text" ng-model="$socpe.field_t = $socpe.field | somefilter" />
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question