diff --git a/src/sb-date-select.js b/src/sb-date-select.js
index a841d20..3427c5a 100644
--- a/src/sb-date-select.js
+++ b/src/sb-date-select.js
@@ -2,14 +2,14 @@
angular.module('sbDateSelect', [])
- .directive('sbDateSelect', [function () {
+ .run(['$templateCache', function ($templateCache) {
var template = [
'
',
- '
'
];
+ $templateCache.put('sb-date-select.html', template.join(''));
+
+ }])
+
+ .directive('sbDateSelect', [function () {
+
return {
restrict: 'A',
replace: true,
- template: template.join(''),
+ templateUrl: function ($element, $attrs) {
+ return $attrs.templateUrl || 'sb-date-select.html';
+ },
require: 'ngModel',
scope: {
selectClass: '@sbSelectClass'
@@ -87,7 +95,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 +125,3 @@ angular.module('sbDateSelect', [])
}
};
}]);
-