无法隐藏周数ngx-bootstrap daterangepicker

时间:2018-08-06 09:06:59

标签: angular typescript ngx-bootstrap

我无法在ngx-bootstrap daterange选择器中隐藏星期数。 我试过的:

.html

 <input type="text" #dp="bsDaterangepicker" (onHidden)="onPickerHide()"  [isOpen]="showPicker"  [(ngModel)]="dateRange" style="position: absolute;visibility: hidden;" placeholder="Daterangepicker" class="form-control" bsDaterangepicker [bsConfig]="dateRangePickerConfig">

app.component.ts

showPicker= true;
datePickerConfig: Partial<BsDatepickerConfig>;
this.datePickerConfig = Object.assign({},
          { showWeekNumbers: false,
           dateInputFormat: 'DD-MM-YYYY'
           }
        );

我收到此控制台错误

enter image description here

1 个答案:

答案 0 :(得分:11)

使用[bsConfig]="{ showWeekNumbers:false }"

我已在 Stackblitz Demo

上创建了一个演示
<input 
    type="text" 
    #dp="bsDaterangepicker" 
    (onHidden)="onPickerHide()" 
    [(ngModel)]="dateRange" 
    style="position: absolute;" 
    bsDaterangepicker 
    [bsConfig]="{ showWeekNumbers:false }" 
/>