AngularJS — how to bind two models?

For example, I have two fields with different models (this is important, because the obtained models, the data needs to go into the different object properties):
<div ng-init="xyz = {foo: "" bar: ""}" <input type="text" ng-model="foo">
<input type="text" ng-model="bar">
</div>

What if I want:
1. to change the value of the model bar if foo changed (and the values to become the same)
2. but not to change foo if bar

How to describe it correctly to connect?
ps googled for two days, the solution is either not found, or not realized that it was a decision
July 2nd 19 at 17:37
2 answers
July 2nd 19 at 17:39
Solution
<input type="text" ng-model="xyz.foo" ng-change="changeBar()">

function changeBar() {
 $scope.xyz.bar = $scope.xyz.foo;
}
July 2nd 19 at 17:41
About this speech?

Find more questions by tags AngularJavaScript