Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Commit 99caac8

Browse files
author
Luke Pommersheim
committed
added dateMinLimit to isolated scope and settup $watch on it.
1 parent d611915 commit 99caac8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/js/angular-datepicker.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
return {
1212
'restrict': 'E',
1313
'scope': {
14-
'dateSet': '@'
14+
'dateSet': '@',
15+
'dateMinLimit': '@',
1516
},
1617
'link': function linkingFunction($scope, element, attr) {
1718
//get child input
@@ -23,8 +24,8 @@
2324
, prevButton = attr.buttonPrev || defaultPrevButton
2425
, nextButton = attr.buttonNext || defaultNextButton
2526
, dateFormat = attr.dateFormat
26-
, dateMinLimit = attr.dateMinLimit || undefined
2727
, dateMaxLimit = attr.dateMaxLimit || undefined
28+
, dateMinLimit
2829
, date = new Date()
2930
, isMouseOn = false
3031
, isMouseOnInput = false
@@ -91,6 +92,12 @@
9192
}
9293
});
9394

95+
$scope.$watch('dateMinLimit', function (value) {
96+
if (value) {
97+
dateMinLimit = value;
98+
}
99+
});
100+
94101
$scope.month = $filter('date')(date, 'MMMM');//December-November like
95102
$scope.monthNumber = Number($filter('date')(date, 'MM')); // 01-12 like
96103
$scope.day = Number($filter('date')(date, 'dd')); //01-31 like

0 commit comments

Comments
 (0)