2015-12-19 167 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