Reputation: 5859
I am using angular.js
in my project. In the template I have :
<div class='form-group'>
<label>Field 1</label>
<input type='text' ng-model='f1' required class="form-control">
</div>
<div class='form-group'>
<label>Field 2</label>
<input type='text' ng-model='f1' required class="form-control">
</div>
My controller
right now is using only one model $scope.f1
I want to pre-populate Field 2
based on Field 1
. But since I am using the same model
if I write something in Field 2
overwrites Field 1
.
I don't want this behavior. I should be able to edit Field 2
later without affecting Field 1
.
Is there a way to achieve this behavior ?
Upvotes: 1
Views: 1764