仅从 ng-bootstrap 安装日期选择器



我想使用ng-bootstrap包中的日期选择器: https://ng-bootstrap.github.io/#/components/datepicker/overview

有没有办法只安装日期选择器及其依赖项而不是所有包?

不能只安装日期选取器,但只能在项目中导入日期选取器。

ng-boostrap导出所有子模块,如果只想使用日期选择器,则只能导入日期选择器:

...
import { NgbDatepickerModule } from '@ng-bootstrap/ng-bootstrap';
...
@NgModule({
imports: [..., NgbDatepickerModule.forRoot()],
...

当你构建你的项目时,只有这个来自ng-bootstrap的模块会被添加到你的捆绑包中。

最新更新