mic*_*kro 4 datepicker angularjs angular-bootstrap
自从我将项目更新为"angular-bootstrap": "~1.2.4",我在控制台中发出警告:
uib-datepicker settings via uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead
uib-datepicker-popup 由日期格式或日期格式数组填充:
uib-datepicker-popup="dd-MMMM-yyyy" 在我的情况下因此,在角度引导程序文档中,仍然显示了deprecated处理此案例的方法.
有谁知道如何迁移到新版本?
他们没有弃用属性"uib-datepicker-popup",该警告与"Datepicker设置"部分中datepicker文档中列出的所有属性相关.您必须通过属性"datepicker-options"提供这些值.不知道为什么,但"弹出设置"部分中的那些没有抛出警告.
在我的情况下,我有
JS
$scope.datepicker.format = 'shortDate';
$scope.datepicker.options = {
formatYear: 'yy',
startingDay: 1
};
Run Code Online (Sandbox Code Playgroud)
HTML
<input type="text" class="form-control"
ng-model="ngModel"
uib-datepicker-popup="{{ datepicker.format }}"
datepicker-options="datepicker.options"
datepicker-append-to-body="true"
is-open="datepicker.opened"
show-button-bar="false"
close-text="Close"
min-date="minDate"
max-date="maxDate"
custom-class="getCustomClass"
show-weeks="false"
/>
Run Code Online (Sandbox Code Playgroud)
它变成了
JS
$scope.datepicker.format = 'shortDate';
$scope.datepicker.options = {
formatYear: 'yy',
startingDay: 1,
minDate: minDate,
maxDate: maxDate,
showWeeks: false,
customClass: getCustomClass
};
Run Code Online (Sandbox Code Playgroud)
HTML
<input type="text" class="form-control"
ng-model="ngModel"
uib-datepicker-popup="{{ datepicker.format }}"
datepicker-options="datepicker.options"
datepicker-append-to-body="true"
is-open="datepicker.opened"
show-button-bar="false"
close-text="Close"
/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13746 次 |
| 最近记录: |