gpt4 book ai didi

angularjs - 如何替换已弃用的 uib-datepicker-popup?

转载 作者:行者123 更新时间:2023-12-03 08:14:37 27 4
gpt4 key购买 nike

由于我将我的项目更新为 "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 insteaduib-datepicker-popup由日期格式或日期格式数组填充:

  • uib-datepicker-popup="dd-MMMM-yyyy"就我而言

  • 所以在 angular bootstrap documentation它仍然显示 deprecated处理这种情况的方法。

    有谁知道如何迁移到新版本?

    最佳答案

    他们没有弃用“uib-datepicker-popup”属性,警告与datepicker docs中列出的所有属性有关。在“日期选择器设置”部分。您必须通过属性“datepicker-options”提供这些值。
    不知道为什么,但“弹出设置”部分中的那些没有发出警告。

    就我而言,我有

    JS

    $scope.datepicker.format = 'shortDate';
    $scope.datepicker.options = {
    formatYear: 'yy',
    startingDay: 1
    };

    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"
    />

    它变成了

    JS
    $scope.datepicker.format = 'shortDate';
    $scope.datepicker.options = {
    formatYear: 'yy',
    startingDay: 1,
    minDate: minDate,
    maxDate: maxDate,
    showWeeks: false,
    customClass: getCustomClass
    };

    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"
    />

    更新

    plunker reproduction

    关于angularjs - 如何替换已弃用的 uib-datepicker-popup?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36285108/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com