小编A. *_*Bin的帖子

类型“未定义”不可分配给类型“ApexAxisChartSeries |” Apex非轴图表系列'

我在ts中使用了这段代码

export type pieChartOptionss = {
  series?: ApexNonAxisChartSeries | '';
  chart?: ApexChart | '';
  legend?: ApexLegend | '';
  dataLabels?: ApexDataLabels | '';
  responsive?: ApexResponsive[] | '';
  labels?: any | '';
};
export class DashboardComponent implements OnInit {
 public pieChartOptionss!: Partial<pieChartOptionss>;
}
     (response: any) => {
          this.user_data = response.results;
          console.log('user_data', this.user_data)
          this.user_data_true = this.user_data.filter(x => x.is_active === true)
          this.user_data_false = this.user_data.filter(x => x.is_active === false)
          this.pieChartData = [this.user_data_true.length, this.user_data_false.length];
          this.pieChartOptionss = {
            series: [this.user_data_true.length, this.user_data_false.length],
            chart: {
              type: 'donut',
              width: 270, …
Run Code Online (Sandbox Code Playgroud)

charts typescript apex angular apexcharts

5
推荐指数
2
解决办法
1万
查看次数

toLowerCase在类型上不存在.打字稿

我想为自动完成素材创建过滤器.

我的模特:

 export class Country {
      country_id: number;
      name: string;
       }
Run Code Online (Sandbox Code Playgroud)

打电话给webmethod ws

 this.ws.AllCountry().subscribe(
      countryes => {
        this.countryes = countryes.map((country) => {
          return new Country(country);
        });
      }
    );
Run Code Online (Sandbox Code Playgroud)

创建此过滤器,但不起作用:

filterStates(val: string) {
    if (val) {
      let filterValue = val.toLowerCase();//toLowerCase does not exist on type Country.
      return this.countryes.filter(name => name.toLowerCase().startsWith(filterValue));
    }
    return this.countryes;
  }
Run Code Online (Sandbox Code Playgroud)

你能告诉我任何解决方案吗?

谢谢

autocomplete filter typescript angular-material angular

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