How to replace obsolete uib-datepicker popup?

Since I updated my project to "angular-bootstrap": "~1.2.4", I have a warning in the console:

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 populated with a date format or an array of date formats:

  • uib-datepicker-popup="dd-MMMM-yyyy" in my case

So, the angular download documentation still shows a way deprecatedto handle this case.

Does anyone know how to upgrade to the new version?

+4
source share
2 answers

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


Update

+5

All Articles