From 1fad3fa204becaed8406c3bd3a7234a435a4da66 Mon Sep 17 00:00:00 2001 From: Mikael Korpela Date: Sat, 20 Feb 2016 15:46:41 +0200 Subject: [PATCH] Use one time binding for the year array, since it is not changing after initializing the directive. https://docs.angularjs.org/guide/expression#one-time-binding --- src/sb-date-select.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sb-date-select.js b/src/sb-date-select.js index a841d20..94187be 100644 --- a/src/sb-date-select.js +++ b/src/sb-date-select.js @@ -12,7 +12,7 @@ angular.module('sbDateSelect', []) '', - '', '', '', '' @@ -87,7 +87,7 @@ angular.module('sbDateSelect', []) if (scope.val.year && scope.val.month && max.isSame([scope.val.year, scope.val.month-1], 'month')) { maxDate = max.date(); - } else if (scope.val.year && scope.val.month) { + } else if (scope.val.year && scope.val.month) { maxDate = moment([scope.val.year, scope.val.month-1]).daysInMonth(); } else { maxDate = 31; @@ -117,4 +117,3 @@ angular.module('sbDateSelect', []) } }; }]); -