控制台日志无法读取我component.ts 上未定义的属性“ toLocaleString”,我正在使用此方法从json获取数据
getChartProducts() {
this.TicketService.getAlladminPage(this.number, this.size, this.sort, this.orderByColumn)
.subscribe(
(chart: any[]) => {
let item = 0;
if (chart['content']) {
while(item < chart['content'].length){
let chartItem = {
'name' : chart['content'][item].name,
'price': chart['content'][item].price
};
this.chart.push(chartItem);
item ++;
}
console.log( this.chart);
}
});
}`
Run Code Online (Sandbox Code Playgroud)
我也设定
`
chart: { name :string, price :number}[] = [];
view: any[] = [700, 400];
// options
showXAxis = true;
showYAxis = true;
gradient = false;
showLegend = true;
showXAxisLabel = true;
showYAxisLabel = …Run Code Online (Sandbox Code Playgroud)