将 ngx-bootstrap 合并到项目中的最佳实践是什么
what are the best practices for incorporating ngx-boostrap in your project
早上好,
我很想知道,您如何将 ngx-bootstrap 模块整合到您的项目中。建议和最佳做法是什么。
谢谢
如 official documentation, you need to import the module of the feature that you need to use inside your angular module 中所写。
例如,假设您需要使用 Datepicker,您将导入它:
import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
@NgModule({
imports: [BsDatepickerModule.forRoot(),...]
})
export class AppModule(){}
然后您就可以在模块中使用 DatePicker。
例如将其添加到您的组件模板之一:
<input
#dp="bsDatepicker"
bsDatepicker
[bsValue]="bsValue"
>
在这种情况下,您需要在组件的 class:
中初始化 bsValue
bsValue = new Date();
早上好,
我很想知道,您如何将 ngx-bootstrap 模块整合到您的项目中。建议和最佳做法是什么。
谢谢
如 official documentation, you need to import the module of the feature that you need to use inside your angular module 中所写。
例如,假设您需要使用 Datepicker,您将导入它:
import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
@NgModule({
imports: [BsDatepickerModule.forRoot(),...]
})
export class AppModule(){}
然后您就可以在模块中使用 DatePicker。
例如将其添加到您的组件模板之一:
<input
#dp="bsDatepicker"
bsDatepicker
[bsValue]="bsValue"
>
在这种情况下,您需要在组件的 class:
中初始化bsValue
bsValue = new Date();