ngx-echarts-starter icon indicating copy to clipboard operation
ngx-echarts-starter copied to clipboard

ngx 编译无法通过

Open victory-wu opened this issue 4 years ago • 0 comments

版本 angular8 "echarts": "^4.9.0", ngx-echarts": "^5.1.2",

方式一:

import echarts from 'echarts';

@NgModule({
  imports: [
    NgxEchartsModule.forRoot({
      echarts: echarts
    })
  ]
})
export class StatisticModule { }

编译后使用浏览器出现错误: main.642581c9bf05d0fd9d9e.js:2 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'init' of null TypeError: Cannot read property 'init' of null

开发模式下能正常使用

方式二:


@NgModule({
  imports: [
    NgxEchartsModule.forRoot({
      echarts: () => import('echarts')    <= line: 26
    })
  ]
})
export class StatisticModule { }

代码无法通过编译

ERROR in Error during template compile of 'StatisticModule' Function expressions are not supported in decorators in 'ɵ0' 'ɵ0' contains the error at app/statistic/statistic.module.ts(26,16) Consider changing the function expression into an exported function.

victory-wu avatar Sep 11 '20 05:09 victory-wu