Angular Daterangepicker更改区域设置

时间:2018-01-26 15:11:32

标签: javascript angularjs

我的问题是关于daterangepicker.com的小部件。我面临的问题是,当我尝试通过更改选项来更改区域设置 $ scope.opts = {...} ng-model $ scope.date = {...}在此之前绑定并始终使用以前的区域设置。

<input date-range-picker id="datepick"
    autoUpdateInput="true"
    name="datepick"
    class="form-control date-picker"
    type="text"
    options="opts"
    ng-model="date"
required/>

1 个答案:

答案 0 :(得分:0)

component.html

>   <div class="row">
>     <div class="input-field col s12">
>       <input formControlName="birthDate" id="birthDate" type="date" class="datepicker" materialize="pickadate" [materializeParams]="[{
> format: 'yyyy-mm-dd', formatSubmit: 'yyyy-mm-dd',
>         closeOnSelect: true, selectMonths: true, selectYears: true, today: '',
>         max: true, onSet: onSetDatepicker }]">
>       <label for="birthDate">Birthday*</label>
>     </div>   </div>

component.ts

>  onSetDatepicker(date) {
>     if (date.select) {
>       $('#birthDate').pickadate().pickadate('picker').close();
>     }   }