我的问题是关于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/>
答案 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();
> } }