繁体   English   中英

未捕获的TypeError:ctorParameters.map不是函数

[英]Uncaught TypeError: ctorParameters.map is not a function

我正在尝试在我的angular2应用程序中使用dragula 这是我的代码中的app.module:

    import { BrowserModule } from '@angular/platform-browser';
    import { NgModule } from '@angular/core';
    import { FormsModule } from '@angular/forms';
    import { HttpModule } from '@angular/http';

    import { DragulaService, DragulaModule } from 'ng2-dragula/ng2-dragula';
    import { AppComponent } from './app.component';
    import { PlayComponent } from './play/play.component';
    import {SelectedInstrumentsService} from './selected-instruments.service';
    import {SizeService} from './size.service';
    import {AudioFinderService} from './audio-finder.service';

    @NgModule({
      declarations: [
        AppComponent,
        PlayComponent
      ],
      imports: [
        BrowserModule,
        FormsModule,
        HttpModule,DragulaModule
      ],
      providers: [DragulaService,SelectedInstrumentsService,SizeService,AudioFinderService],
      bootstrap: [AppComponent]
    })

export class AppModule { }

不幸的是,当我将DragulaService添加到providers或将DragulaModuleimports遇到以下错误:

Uncaught TypeError: ctorParameters.map is not a function
    at ReflectionCapabilities.parameters (http://localhost:4200/main.bundle.js:39645:47)
    at Reflector.parameters (http://localhost:4200/main.bundle.js:39856:48)
    at CompileMetadataResolver.getDependenciesMetadata (http://localhost:4200/main.bundle.js:22231:156)
    at CompileMetadataResolver.getTypeMetadata (http://localhost:4200/main.bundle.js:22196:26)
    at CompileMetadataResolver.getDirectiveMetadata (http://localhost:4200/main.bundle.js:21969:28)
    at http://localhost:4200/main.bundle.js:22038:49
    at Array.forEach (native)
    at CompileMetadataResolver.getNgModuleMetadata (http://localhost:4200/main.bundle.js:22031:44)
    at http://localhost:4200/main.bundle.js:22019:50
    at Array.forEach (native)

我确定,我已经正确安装了dragula

有一个未解决的问题: https : //github.com/valor-software/ng2-dragula/issues/496

您可以在package.json中将Angular 2.1.1和Dragula 1.2.0与以下内容结合使用:

"dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "ng2-dragula": "1.2.0",
...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM