我试图将ngx-bootstrap与angular5集成并尝试添加其组件。
ng add ngx-bootstrap --component alerts
这是投掷错误:
指定的命令add无效。有关可用选项,请参阅ng help
。
你可以使用另一种手动安装它的方法,
从npm安装ngx-bootstrap,在项目根文件夹中运行此命令
npm install ngx-bootstrap --save
向NgModule导入添加所需的包:
import { AlertModule } from 'ngx-bootstrap';
@NgModule({
imports: [AlertModule.forRoot(),...]
})
对于Bootstrap3,
<!-- index.html -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
对于Bootstrap4,
<!--- index.html -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
更新:
[Here is]从头开始完成Angular5 + ngx-bootstrap的实现
ng add不适用于角度5,更新为6或7