要使用Angular 5和ngx-bootstrap,您需要按照以下步骤进行设置:
npm install -g @angular/cli
ng new my-app
cd my-app
npm install ngx-bootstrap --save
import { AlertModule } from 'ngx-bootstrap/alert';
import { ButtonsModule } from 'ngx-bootstrap/buttons';
@NgModule({
imports: [
BrowserModule,
AlertModule.forRoot(),
ButtonsModule.forRoot(),
// other imports...
],
// other code...
})
import { Component } from '@angular/core';
template: `
This is a success alert
`,
ng serve
这是一个简单的示例,演示了如何使用Angular 5和ngx-bootstrap。您可以根据自己的需求在组件中使用更多的ngx-bootstrap组件和样式。请参考ngx-bootstrap的官方文档以获取更多信息和示例代码:https://valor-software.com/ngx-bootstrap/