出于某种原因,当我尝试在ng-repeat中添加md-select时,它开始给我错误。这是我想要完成的一个简单例子:
App.controller('Forumlaire_Controller', function ($scope, Shared_Service) {
$scope.Parent_Data = [{Name:"Bob", Selection: "1"},{Name:"Rick", Selection: "2"},{Name:"Lori", Selection: "3"} ];
$scope.selections = [{1: "Option1",2: "Option 2",3: "Option 4",4: "Option 5",5: "Option 6"}]
})
在下面的示例中,我收到了错误
“[ngRepeat:iexp]”在集合中的'项形式的预期表达式[通过 id ]跟踪':
<div ng-repeat="parent for Parent_Data">
<md-input-container style="margin-top: 5px; margin-bottom: 5px;" flex="25">
<label>État</label>
<md-select ng-model="Example">
<md-option ng-repeat="item for selections" ng-value="item"> {{item}} </md-option>
</md-select>
</md-input-container>
</div>
我尝试了以下内容,我不会再出现错误,但我无法选择任何内容。选择卡在第一个选项上:
<div ng-repeat="parent for Parent_Data">
<md-input-container style="margin-top: 5px; margin-bottom: 5px;" flex="25">
<label>État</label>
<md-select ng-model="Example" ng-model-options="{ trackBy: '$index' }">
<md-option ng-repeat="item in selections" ng-value="item"> {{item}} </md-option>
</md-select>
</md-input-container>
</div>
有谁知道问题是什么?