小编Nam*_*ila的帖子

找不到模块:错误:无法使用打字稿解析“react-select”

模块导入对我不起作用。我尝试了堆栈溢出和其他提供的不同解决方案。这些是我遵循反应选择的步骤

npm install --save @types/react-select
Run Code Online (Sandbox Code Playgroud)

像这样导入模块

import Select from "react-select"
Run Code Online (Sandbox Code Playgroud)

但我得到了错误

找不到模块:错误:无法解析“react-select”

import * as React from "react";
import ReactSelect from 'react-select'
export class Select extends extends React.Component<someProps>{

render(){
   return(
  <Select id="color" options={options} />
);
}
}
Run Code Online (Sandbox Code Playgroud)

但我找不到解决这个问题的方法。

typescript reactjs react-select

7
推荐指数
2
解决办法
3万
查看次数

在订阅Angular 5中绑定一个对象

当我要将数据绑定到全局变量时,我正在尝试从WebApi和Getting Undfind获取数据.

这是我的订阅

    export class OverallSummaryGaugeComponent implements OnInit {

  gaugeVal: any;
  bfd;
  pb: ProductionBreakDown[];
  gaugeSummaryType: String;
  constructor(private _sampleDataService: SampleDataObjectService, private _dashboard: DashboardService) { }
  customizeText(arg) {
    return arg.valueText + ' %';
  }

  ngOnInit() {
    this.gaugeVal = this._sampleDataService.CompletedPrasantage;
    this.getallData();
  }
  getallData() {
    this._dashboard.getProductionBreakDownByDate()
    .subscribe(pb => this.pb = pb
    );
    console.log(this.pb);
  }
}
Run Code Online (Sandbox Code Playgroud)

当我改变代码时,就像它的打印数据一样.

this._dashboard.getProductionBreakDownByDate()
          .subscribe(pb => console.log(pb)
          );
          console.log(this.bd);
      }
Run Code Online (Sandbox Code Playgroud)

但我试图将它绑定到获取未定义的相同类型的列表.

这是我的Observable代码

    @Injectable()
export class DashboardService extends BaseService {
    private _getProductionBreakDown = UrlsConfig.ptsapi + 'productionBreakDown/filterByDate/2018-12-17';
    constructor(private _dataAccessService: DataAccessService) {
        super(_dataAccessService);
    } …
Run Code Online (Sandbox Code Playgroud)

angular

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

标签 统计

angular ×1

react-select ×1

reactjs ×1

typescript ×1