1.安装bootstrap所需要的组件
npm install --save ng-bootstrap/ng-bootstrap
npm install --save bootstrap@v4.0.0-beta.2
npm install --save font-awesome
2.在angular.json文件,添加bootstrap CSS
"styles": [ "src/styles.styl",
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/font-awesome/css/font-awesome.css",
"node_modules/bootstrap/dist/css/bootstrap.css"
],
3.打开需要引用它的组件,初始化ng-bootstap
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
@NgModule({
declarations: [AppComponent, ...],
imports: [NgbModule.forRoot(), ...],
bootstrap: [AppComponent]
})
export class AppModule {
}
4.引用即可