2015-12-19 222 views
0

在我的JavaScript,我有NG-模型失去焦点

$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> 

每当我键入的东西,它失去焦点在输入框中。

回答

1

原来我需要做的:

<div class="row" ng-repeat="answer in newQuestion.answers track by $index">

+3

哇!你很快就能解决问题 – Tushar