在我的JavaScript中,我有
$scope.newQuestion = {
answers: []
};
我的HTML
<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>
每当我输入内容时,它都会在输入框中失去焦点。
答案 0 :(得分:1)
原来我需要这样做:
<div class="row" ng-repeat="answer in newQuestion.answers track by $index">