[英]ngx-bootstrap datepicker - disable specific days
I am using v2.0.1 of ngx-bootstrap in my project. 我在我的项目中使用ngx-bootstrap v2.0.1。 I am trying to configure the datepicker to disable certain days.
我正在尝试将日期选择器配置为禁用某些日期。 The config option is dayDisabled.
config选项为dayDisabled。 This feature was implemented in v2.0.0 of ngx-bootstrap.
此功能已在ngx-bootstrap的v2.0.0中实现。 https://github.com/valor-software/ngx-bootstrap/pull/2744/files The way I am implementing it is not picking it up.
https://github.com/valor-software/ngx-bootstrap/pull/2744/files我实现它的方式不是去捡它。
<div class="row">
<div class="col-xs-12 col-12 col-md-4 form-group">
<input
class="form-control"
placeholder="Datepicker"
bsDatepicker
[bsConfig]="{ dayDisabled: '[0,1,2,3]', containerClass: 'theme-red' }">
</div>
</div>
You can use BsDatepickerConfig
: 您可以使用
BsDatepickerConfig
:
dayDisabled: [0, 1, 2]
into bsConfig
dayDisabled: [0, 1, 2]
进入bsConfig
or 要么
dayDisabled: '[0,1,2,3]' = dayDisabled: [0,1,2,3]
https://valor-software.com/ngx-bootstrap/#/datepicker#themes https://valor-software.com/ngx-bootstrap/#/datepicker#themes
import { Component } from '@angular/core';
import { BsDatepickerConfig } from 'ngx-bootstrap/datepicker';
@Component({
selector: 'demo-datepicker-color-theming',
templateUrl: './color-theming.html'
})
export class DemoDatepickerColorThemingComponent {
colorTheme = 'theme-green';
bsConfig: Partial<BsDatepickerConfig>;
applyTheme(pop: any) {
// create new object on each property change
// so Angular can catch object reference change
this.bsConfig = Object.assign({}, { containerClass: this.colorTheme, dayDisabled: [0, 1, 2] });
setTimeout(() => {
pop.show();
});
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.