1

当尝试将 DropdownModule 和 ButtonsModule 与 ng2-bootstrap 的最新(1.1.14)版本一起使用时,出现以下错误

Uncaught Error: Unexpected module 'DropdownModule' declared by the module

我一直在使用带有 1.0.24 版本的 ng2-bootstrap 的 DROPDOWN_DIRECTIVES 和 BUTTON_DIRECTIVES。尝试转换时,我什至无法在我的 NgModule 中声明它而不会出现错误

这是我的模块

import { DeviceService } from "./services/device.service";
import { DlSimpleFilterComponent } from "./dl-simple-filter/dl-simple-filter.component";
import { HttpModule } from "@angular/http";
import { TimepickerComponent} from "ng2-bootstrap";

//BDS Removed to get running
//import { DropdownModule, ButtonsModule } from 'ng2-bootstrap/ng2-bootstrap';
//import { DropdownModule } from 'ng2-bootstrap/ng2-bootstrap';
import { DropdownModule } from 'ng2-bootstrap/components/dropdown';


@NgModule({
    imports:      [
        BrowserModule,
        FormsModule,
        HttpModule
    ],
    declarations: [
        AppComponent,
        OperatorPipe,
        ConversationPipe,
        DlSimpleFilterComponent,
        DropdownModule,
//        ButtonsModule,
        TimepickerComponent
    ],
    providers: [
        OperatorService,
        ConversationService,
        DeviceService,
        DlSimpleFilterComponent
    ],
    bootstrap:    [
        AppComponent
    ]
})
export class AppModule { }
4

1 回答 1

3

模块应该放在@NgModule.imports不是declarations.

imports:      [
    BrowserModule,
    FormsModule,
    HttpModule,
    DropdownModule,
],
于 2016-10-25T14:33:14.497 回答