diff --git a/src/datepicker/datepicker.js b/src/datepicker/datepicker.js index fd4e263660..2520a20d4f 100644 --- a/src/datepicker/datepicker.js +++ b/src/datepicker/datepicker.js @@ -42,6 +42,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst this.modes = ['day', 'month', 'year']; [ + 'changePeriod', 'customClass', 'dateDisabled', 'datepickerMode', @@ -63,6 +64,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst 'yearRows' ].forEach(function(key) { switch (key) { + case 'changePeriod': case 'customClass': case 'dateDisabled': $scope[key] = $scope.datepickerOptions[key] || angular.noop; @@ -283,7 +285,14 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst var year = self.activeDate.getFullYear() + direction * (self.step.years || 0), month = self.activeDate.getMonth() + direction * (self.step.months || 0); self.activeDate.setFullYear(year, month, 1); - self.refreshView(); + + if ($scope.changePeriod) { + $scope.changePeriod({date: self.activeDate, mode: $scope.datePickerMode }).then(function () { + self.refreshView(); + }); + } else { + self.refreshView(); + } }; $scope.toggleMode = function(direction) {