2

我正在尝试在我的 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正确安装了。

4

1 回答 1

5

有一个未解决的问题: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",
...
于 2017-01-04T16:28:35.880 回答