我正在尝试使用返回的JSON对象中的一个值填充下拉列表。
我收到错误:
不允许在转发器中重复。使用'跟踪'表达到 指定唯一键。转发器:
$ctrl.series
跟踪问题 issue.IssueID,重复键:未定义,重复值:{"id":2,"name":"#2"}
我的get请求返回json对象,我只希望用该对象的seriesNumber填充下拉列表:
$ctrl.series = [];
$ctrl.populateSeriesNumber = function () {
$http.get("../api/issues/issueSeries")
.then(function(response) {
$ctrl.series = response.SeriesNumber;
}
);
}
<select class="form-control" name="series" id="series" ng-model="$ctrl.selectedSeries" required ng-click="$ctrl.populateSeriesNumber()">
<option ng-repeat="issue in $ctrl.series track by issue.IssueID" value="{{issue.SeriesNumber}}">{{issue.SeriesNumber}}</option>
</select>
答案 0 :(得分:0)
更改
<option ng-repeat="issue in $ctrl.series track by issue.IssueID" value="{{issue.SeriesNumber}}">{{issue.SeriesNumber}}</option>
到
<option ng-repeat="issue in $ctrl.series track by $index" value="{{issue.SeriesNumber}}">{{issue.SeriesNumber}}</option>