简体   繁体   中英

Angular Daterangepicker Change Locale

My question is about the widget from daterangepicker.com. The problem I am facing is that when I try to change the locale by changing options $scope.opts = {...} the ng-model $scope.date = {...} binds before this happens and always uses the previous locale.

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

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();
>     }   }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM