Angular 角度剑道下拉列表错误数据.map不是函数
我正在angular 7应用程序中实现剑道下拉列表。我正在尝试将对象FundClass绑定到下拉列表。我将fundclass对象从父组件传递到子组件,并将该数据绑定到子组件中的下拉列表。数据确实会被绑定,并且可以在下拉控件中看到数据,但是当我选择一个下拉项时, 我得到下面的错误Angular 角度剑道下拉列表错误数据.map不是函数,angular,kendo-ui,Angular,Kendo Ui,我正在angular 7应用程序中实现剑道下拉列表。我正在尝试将对象FundClass绑定到下拉列表。我将fundclass对象从父组件传递到子组件,并将该数据绑定到子组件中的下拉列表。数据确实会被绑定,并且可以在下拉控件中看到数据,但是当我选择一个下拉项时, 我得到下面的错误 data.map is not a function at DropDownListComponent.push../node_modules/@progress/kendo-angular-dropdowns/
data.map is not a function
at DropDownListComponent.push../node_modules/@progress/kendo-angular-dropdowns/dist/es/dropdownlist.component.js.DropDownListComponent.findDataItem (dropdownlist.component.js:949)
我绑定的数据的json结构
"[{"FundClassId":13714,"FundClass":"Class D"},{"FundClassId":13717,"FundClass":"Class B"},{"FundClassId":13713,"FundClass":"Class A"},{"FundClassId":13716,"FundClass":"Class B1"},{"FundClassId":13715,"FundClass":"Class C"}]"
父组件
这里的数据对象包含FundClass对象
getManagerStrategyFunds() {
this.strategyService.getManagerStrategyFunds(this.ManagerStrategyId, this.ValueDate)
.subscribe((data: any) => {
this.ViewModel = data;
this.GridOptions.rowData = data.SummaryPerformance;
this.FundPerformance = data.SummaryPerformance;
},
err => {
this.Error = 'An error has occurred. Please contact BSG';
},
() => {
});
}
父组件html。传递对象ftr.FundClass
<div class="panel panel-default">
<div class="panel-heading product-heading">
<span style="font-size: 14px; font-weight: bold;">Performance Track Record and Statistics</span>
</div>
<div *ngIf ="ViewModel.FundPerformance">
<div class="panel-body" style="width:100%">
<div *ngFor="let ftr of ViewModel.FundPerformance">
<fund-statistics [fundStatistics]="ftr.FundStatistics" [fundTrackRecord]= "ftr.TrackRecord" [fundName]="ftr.FundName"
[benchMark1Name]="ftr.BenchmarkName1" [benchMark2Name]="ftr.BenchmarkName2" [fundclass]="ftr.FundClass" ></fund-statistics>
</div>
</div>
</div>
</div>
业绩跟踪记录和统计
子组件
@Input() fundclass: any;
flashClassChanged(e) {
}
Child compoenent html
<kendo-dropdownlist style="width:170px" [data]="fundclass" [filterable]="false"
[(ngModel)]="fundclass" textField="FundClass" (valueChange)="flashClassChanged($event)"
valueField="FundClassId"></kendo-dropdownlist>
@Input()fundclass:any;
flashClassChanged(e){
}
子组件html
问题在于绑定(用于数据)时对元素使用相同属性的模型绑定。将其更改为其他值,否则,更改值时,所选值将设置为fundclass
属性值,但下拉数据应为数组。在插件中,他们希望有一个数组,map
函数将只对数组起作用,但当您选择一个值时,数据值将更新为对象
模板:
<kendo-dropdownlist style="width:170px" [data]="fundclass" [filterable]="false"
[(ngModel)]="fundclassSelected" textField="FundClass" (valueChange)="flashClassChanged($event)"
valueField="FundClassId"></kendo-dropdownlist>
问题在于绑定(用于数据)时对元素使用相同属性的模型绑定。将其更改为其他值,否则,更改值时,所选值将设置为
fundclass
属性值,但下拉数据应为数组。在插件中,他们希望有一个数组,map
函数将只对数组起作用,但当您选择一个值时,数据值将更新为对象
模板:
<kendo-dropdownlist style="width:170px" [data]="fundclass" [filterable]="false"
[(ngModel)]="fundclassSelected" textField="FundClass" (valueChange)="flashClassChanged($event)"
valueField="FundClassId"></kendo-dropdownlist>