Answer the question
In order to leave comments, you need to log in
AngularJS - how to link two models?
For example, I have two fields with different models (this is important because the data received from the models must go into different properties of the object):
<div ng-init="xyz = {foo: "", bar: ""}"
<input type="text" ng-model="foo" />
<input type="text" ng-model="bar" />
</div>
Answer the question
In order to leave comments, you need to log in
<input type="text" ng-model="xyz.foo" ng-change="changeBar()"/>
function changeBar() {
$scope.xyz.bar = $scope.xyz.foo;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question