小编Nik*_*las的帖子

无法读取未定义的属性“ toLocaleString”。角度5 ngx图

控制台日志无法读取我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)

ngx-datatable angular ngx-charts angular5

1
推荐指数
1
解决办法
4025
查看次数

标签 统计

angular ×1

angular5 ×1

ngx-charts ×1

ngx-datatable ×1