Reputation: 43609
In my JavaScript, I have
$scope.newQuestion = {
answers: []
};
My HTML is
<div class="row" ng-repeat="answer in newQuestion.answers">
<div class="input-field col m12">
<input id="answer{{ $index }}" type="text" class="validate" ng-model="newQuestion.answers[$index]">
</div>
</div>
Whenever I type something, it loses focus in the input box.
Upvotes: 0
Views: 77
Reputation: 43609
Turns out I needed to do:
<div class="row" ng-repeat="answer in newQuestion.answers track by $index">
Upvotes: 1