我需要在 index.html 中添加 bootstrap.min.css 才能使用 ng-bootstrap 吗?
Do I need to add bootstrap.min.css in index.html to use ng-bootstrap?
我正在使用 angular-cli@webpack version with ng-bootstrap (not ng2-bootstrap)。我对 angular-cli 项目执行了以下操作:
npm install --save @ng-bootstrap/ng-bootstrap
然后将其添加到我的文件中:
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
然后我将这个添加到 index.html:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.3/css/bootstrap.min.css">
很好,一切正常。我的问题:
(第 1 部分)我真的必须在 index.html 中添加 bootstrap.min.css 吗?我可以不将 bootstrap.css 添加到 index.html 并仍然使用 ng-boostrap 吗?
(第 2 部分)如果不是,那为什么 ng-bootstrap 不能只在他们的设置中包含 bootstrap.css,所以我不需要将它添加到index.html?
不确定你是否检查过官方 page,显然目前有 2 个依赖项:
- angular版本
- bootstrap css
Dependencies This repository contains a set of native Angular 2
directives based on Bootstrap's markup and CSS. As a result no
dependency on jQuery or Bootstrap's JavaScript is required. The only
required dependencies are:
Angular (requires Angular version 2 or higher, tested with 2.0-rc.5)
Bootstrap CSS (tested with version 4.0 alpha V3)
编辑:从逻辑上看:因为人们可能想使用自定义 bootstrap.css 文件。
正如@juhana
所提到的
我正在使用 angular-cli@webpack version with ng-bootstrap (not ng2-bootstrap)。我对 angular-cli 项目执行了以下操作:
npm install --save @ng-bootstrap/ng-bootstrap
然后将其添加到我的文件中:
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
然后我将这个添加到 index.html:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.3/css/bootstrap.min.css">
很好,一切正常。我的问题:
(第 1 部分)我真的必须在 index.html 中添加 bootstrap.min.css 吗?我可以不将 bootstrap.css 添加到 index.html 并仍然使用 ng-boostrap 吗?
(第 2 部分)如果不是,那为什么 ng-bootstrap 不能只在他们的设置中包含 bootstrap.css,所以我不需要将它添加到index.html?
不确定你是否检查过官方 page,显然目前有 2 个依赖项:
- angular版本
- bootstrap css
Dependencies This repository contains a set of native Angular 2 directives based on Bootstrap's markup and CSS. As a result no dependency on jQuery or Bootstrap's JavaScript is required. The only required dependencies are:
Angular (requires Angular version 2 or higher, tested with 2.0-rc.5) Bootstrap CSS (tested with version 4.0 alpha V3)
编辑:从逻辑上看:因为人们可能想使用自定义 bootstrap.css 文件。 正如@juhana
所提到的