无法将 DropdownModule 与 ng2-bootstrap 一起使用
Unable to use DropdownModule with ng2-bootstrap
当尝试将 DropdownModule 和 ButtonsModule 与最新 (1.1.14) 版本的 ng2-bootstrap 一起使用时,出现以下错误
Uncaught Error: Unexpected module 'DropdownModule' declared by the module
我一直在使用 DROPDOWN_DIRECTIVES 和 BUTTON_DIRECTIVES 以及 1.0.24 版本的 ng2-bootstrap。尝试转换时,我什至无法在没有错误的情况下在我的 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 { }
模块应该放在 @NgModule.imports
而不是 declarations
。
imports: [
BrowserModule,
FormsModule,
HttpModule,
DropdownModule,
],
当尝试将 DropdownModule 和 ButtonsModule 与最新 (1.1.14) 版本的 ng2-bootstrap 一起使用时,出现以下错误
Uncaught Error: Unexpected module 'DropdownModule' declared by the module
我一直在使用 DROPDOWN_DIRECTIVES 和 BUTTON_DIRECTIVES 以及 1.0.24 版本的 ng2-bootstrap。尝试转换时,我什至无法在没有错误的情况下在我的 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 { }
模块应该放在 @NgModule.imports
而不是 declarations
。
imports: [
BrowserModule,
FormsModule,
HttpModule,
DropdownModule,
],