angular 如何使用第三方组件ng-bootstrap?

1.在你的项目中以下指令 npm install --save @ng-bootstrap/ng-bootstrap

安装完成会显示

+ @ng-bootstrap/ng-bootstrap@1.0.0-beta.4

added 1 package in 8.757s

2.在AppModule模块中引入这个组件:

import {NgbModule} from '@ng-bootstrap/ng-bootstrap';

@NgModule({
  declarations: [AppComponent, ...],
  imports: [NgbModule.forRoot(), ...],
  bootstrap: [AppComponent]
})
export class AppModule {
}

3.在(想要使ng-bootatrap组的)组件中引入这个模块:

import {NgbModule} from '@ng-bootstrap/ng-bootstrap';

@NgModule({
  declarations: [OtherComponent, ...],
  imports: [NgbModule, ...]
})
export class OtherModule {
}

4。完成第三方组件的使用。