我正在使用ng2-nvd3模块进行图表。以下是代码
角度2,离子2
import {nvD3} from "ng2-nvd3/build/lib/ng2-nvd3";
@NgModule({
declarations: [
nvD3,
...
})
我收到以下错误。任何人都可以帮我解决以下错误
[15:51:10] lint finished in 1.04 s
[15:51:11] ngc: Error: Unexpected value 'nvD3' declared by the module 'AppModule'
at /Users/…/node_modules/@angular/compiler/bundles/compiler.umd.js:14044:33
at Array.forEach (native)
at CompileMetadataResolver.getNgModuleMetadata (/Users/…/node_modules/@angular/compiler/bundles/compiler.umd.js:14031:51)
at /Users/..//node_modules/@angular/compiler/bundles/compiler.umd.js:12801:47
at Array.forEach (native)
at analyzeModules (/Users/…/node_modules/@angular/compiler/bundles/compiler.umd.js:12800:17)
at OfflineCompiler.analyzeModules (/Users/…/node_modules/@angular/compiler/bundles/compiler.umd.js:12826:18)
at CodeGenerator.codegen (/Users/…/node_modules/@angular/compiler-cli/src/codegen.js:105:47)
at codegen (/Users/…/node_modules/@angular/compiler-cli/src/main.js:7:81)
at Object.main (/Users/..//node_modules/@angular/tsc-wrapped/src/main.js:30:16)
答案 0 :(得分:0)
我遇到了同样的错误,以下是我在代码中修复它的方法:
...
import { Key } from "../../utils/key";
declare var setLanguage; //Makes sure this forcing of type (a hack) is here
@Component({
selector: "page-home",
templateUrl: "home.html",
providers: [Storage]
})
//declare var setLanguage; //NOT HERE
export class HomePage {
...
答案 1 :(得分:0)
错误
import {nvD3} from "ng2-nvd3/build/lib/ng2-nvd3";
右
import { nvD3 } from 'ng2-nvd3';