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

Commit 148a759

Browse files
committed
Merge pull request #23 from lpommers/add-min-and-max-date-to-isolate-scope
Add min and max date to isolate scope
2 parents d611915 + 6e3bfda commit 148a759

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/js/angular-datepicker.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
return {
1212
'restrict': 'E',
1313
'scope': {
14-
'dateSet': '@'
14+
'dateSet': '@',
15+
'dateMinLimit': '@',
16+
'dateMaxLimit': '@'
1517
},
1618
'link': function linkingFunction($scope, element, attr) {
1719
//get child input
@@ -23,8 +25,8 @@
2325
, prevButton = attr.buttonPrev || defaultPrevButton
2426
, nextButton = attr.buttonNext || defaultNextButton
2527
, dateFormat = attr.dateFormat
26-
, dateMinLimit = attr.dateMinLimit || undefined
27-
, dateMaxLimit = attr.dateMaxLimit || undefined
28+
, dateMinLimit
29+
, dateMaxLimit
2830
, date = new Date()
2931
, isMouseOn = false
3032
, isMouseOnInput = false
@@ -91,6 +93,18 @@
9193
}
9294
});
9395

96+
$scope.$watch('dateMinLimit', function (value) {
97+
if (value) {
98+
dateMinLimit = value;
99+
}
100+
});
101+
102+
$scope.$watch('dateMaxLimit', function (value) {
103+
if (value) {
104+
dateMaxLimit = value;
105+
}
106+
});
107+
94108
$scope.month = $filter('date')(date, 'MMMM');//December-November like
95109
$scope.monthNumber = Number($filter('date')(date, 'MM')); // 01-12 like
96110
$scope.day = Number($filter('date')(date, 'dd')); //01-31 like

0 commit comments

Comments
 (0)