仅从ng-bootstrap安装datepicker

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

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

有没有办法只安装datepicker及其依赖项而不是所有的包?

angular npm-install ng-bootstrap
1个回答
4
投票

您不能仅安装日期选择器,但您只能导入项目中的日期选择器。

ng-boostrap exports all the sub modules,如果你只想使用datepicker,你只能导入datepicker:

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

当您构建项目时,只有ng-bootstrap中的此模块将添加到您的包中。

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