ng add不适用于使用angular 5的ngx-bootstrap

问题描述 投票:0回答:2

我试图将ngx-bootstrap与angular5集成并尝试添加其组件。

ng add ngx-bootstrap  --component alerts

这是投掷错误:

指定的命令add无效。有关可用选项,请参阅ng help

angular5 angular-cli ngx-bootstrap
2个回答
1
投票

你可以使用另一种手动安装它的方法,

从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">

[Source]

更新:

[Here is]从头开始完成Angular5 + ngx-bootstrap的实现


1
投票

ng add不适用于角度5,更新为6或7

© www.soinside.com 2019 - 2024. All rights reserved.