@@ -29,8 +29,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
29
29
30
30
// Configuration attributes
31
31
angular . forEach ( [ 'formatDay' , 'formatMonth' , 'formatYear' , 'formatDayHeader' , 'formatDayTitle' , 'formatMonthTitle' ,
32
- 'minMode' , 'maxMode' , ' showWeeks', 'startingDay' , 'yearRange' , 'shortcutPropagation' ] , function ( key , index ) {
33
- self [ key ] = angular . isDefined ( $attrs [ key ] ) ? ( index < 8 ? $interpolate ( $attrs [ key ] ) ( $scope . $parent ) : $scope . $parent . $eval ( $attrs [ key ] ) ) : datepickerConfig [ key ] ;
32
+ 'showWeeks' , 'startingDay' , 'yearRange' , 'shortcutPropagation' ] , function ( key , index ) {
33
+ self [ key ] = angular . isDefined ( $attrs [ key ] ) ? ( index < 6 ? $interpolate ( $attrs [ key ] ) ( $scope . $parent ) : $scope . $parent . $eval ( $attrs [ key ] ) ) : datepickerConfig [ key ] ;
34
34
} ) ;
35
35
36
36
// Watchable date attributes
@@ -45,8 +45,22 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
45
45
}
46
46
} ) ;
47
47
48
+ angular . forEach ( [ 'minMode' , 'maxMode' ] , function ( key ) {
49
+ if ( $attrs [ key ] ) {
50
+ $scope . $parent . $watch ( $parse ( $attrs [ key ] ) , function ( value ) {
51
+ self [ key ] = angular . isDefined ( value ) ? value : $attrs [ key ] ;
52
+ $scope [ key ] = self [ key ] ;
53
+ if ( ( key == 'minMode' && self . modes . indexOf ( $scope . datepickerMode ) < self . modes . indexOf ( self [ key ] ) ) || ( key == 'maxMode' && self . modes . indexOf ( $scope . datepickerMode ) > self . modes . indexOf ( self [ key ] ) ) ) {
54
+ $scope . datepickerMode = self [ key ] ;
55
+ }
56
+ } ) ;
57
+ } else {
58
+ self [ key ] = datepickerConfig [ key ] || null ;
59
+ $scope [ key ] = self [ key ] ;
60
+ }
61
+ } ) ;
62
+
48
63
$scope . datepickerMode = $scope . datepickerMode || datepickerConfig . datepickerMode ;
49
- $scope . maxMode = self . maxMode ;
50
64
$scope . uniqueId = 'datepicker-' + $scope . $id + '-' + Math . floor ( Math . random ( ) * 10000 ) ;
51
65
52
66
if ( angular . isDefined ( $attrs . initDate ) ) {
@@ -562,7 +576,7 @@ function ($compile, $parse, $document, $rootScope, $position, dateFilter, datePa
562
576
}
563
577
564
578
scope . watchData = { } ;
565
- angular . forEach ( [ 'minDate' , 'maxDate' , 'datepickerMode' , 'initDate' , 'shortcutPropagation' ] , function ( key ) {
579
+ angular . forEach ( [ 'minMode' , 'maxMode' , ' minDate', 'maxDate' , 'datepickerMode' , 'initDate' , 'shortcutPropagation' ] , function ( key ) {
566
580
if ( attrs [ key ] ) {
567
581
var getAttribute = $parse ( attrs [ key ] ) ;
568
582
scope . $parent . $watch ( getAttribute , function ( value ) {
0 commit comments