diff --git a/build/angular-date-range-picker.js b/build/angular-date-range-picker.js index e64b5c3..db741d1 100644 --- a/build/angular-date-range-picker.js +++ b/build/angular-date-range-picker.js @@ -2,7 +2,7 @@ angular.module("dateRangePicker", ['pasvaz.bindonce']); angular.module("dateRangePicker").directive("dateRangePicker", [ - "$compile", function($compile) { + "$compile", "$timeout", function($compile, $timeout) { var CUSTOM, pickerTemplate; pickerTemplate = "
"; CUSTOM = "CUSTOM"; @@ -174,9 +174,11 @@ } } $scope.model = $scope.selection; - if ($scope.callback) { - $scope.callback(); - } + $timeout(function() { + if ($scope.callback) { + return $scope.callback(); + } + }); return $scope.hide(); }; $scope.select = function(day, $event) { diff --git a/build/angular-date-range-picker.min.js b/build/angular-date-range-picker.min.js index 94965e8..91f8de2 100644 --- a/build/angular-date-range-picker.min.js +++ b/build/angular-date-range-picker.min.js @@ -1,2 +1,2 @@ /*! angular-date-range-picker 2014-05-26 */ -(function(){angular.module("dateRangePicker",["pasvaz.bindonce"]),angular.module("dateRangePicker").directive("dateRangePicker",["$compile",function(a){var b,c;return c='',b="CUSTOM",{restrict:"AE",replace:!0,template:'\n \n {{ model.start.format("ll") }} - {{ model.end.format("ll") }}\n Select date range\n \n \n {{ model.format("ll") }}\n Select date\n \n',scope:{model:"=ngModel",customSelectOptions:"=",ranged:"=",pastDates:"@",callback:"&"},link:function(d,e){var f,g,h,i,j,k;return d.quickListDefinitions=d.customSelectOptions,null==d.quickListDefinitions&&(d.quickListDefinitions=[{label:"This week",range:moment().range(moment().startOf("week").startOf("day"),moment().endOf("week").startOf("day"))},{label:"Next week",range:moment().range(moment().startOf("week").add(1,"week").startOf("day"),moment().add(1,"week").endOf("week").startOf("day"))},{label:"This fortnight",range:moment().range(moment().startOf("week").startOf("day"),moment().add(1,"week").endOf("week").startOf("day"))},{label:"This month",range:moment().range(moment().startOf("month").startOf("day"),moment().endOf("month").startOf("day"))},{label:"Next month",range:moment().range(moment().startOf("month").add(1,"month").startOf("day"),moment().add(1,"month").endOf("month").startOf("day"))}]),d.quick=null,d.range=null,d.selecting=!1,d.visible=!1,d.start=null,d.showRanged=void 0===d.ranged?!0:d.ranged,j=function(a){var c,e,f,g,h;if(null==a&&(a=!1),d.showRanged){for(d.quickList=[],a&&d.quickList.push({label:"Custom",range:b}),g=d.quickListDefinitions,h=[],e=0,f=g.length;f>e;e++)c=g[e],h.push(d.quickList.push(c));return h}},h=function(){var a,b;return d.showRanged?d.range=d.selection?(b=d.selection.start.clone().startOf("month").startOf("day"),a=b.clone().add(2,"months").endOf("month").startOf("day"),moment().range(b,a)):moment().range(moment().startOf("month").subtract(1,"month").startOf("day"),moment().endOf("month").add(1,"month").startOf("day")):(d.selection=!1,d.selection=d.model||!1,d.date=d.model||moment(),d.range=moment().range(moment(d.date).startOf("month"),moment(d.date).endOf("month")))},i=function(){var a,c,e,f;if(d.showRanged&&d.selection){for(f=d.quickList,c=0,e=f.length;e>c;c++)if(a=f[c],a.range!==b&&d.selection.start.startOf("day").unix()===a.range.start.startOf("day").unix()&&d.selection.end.startOf("day").unix()===a.range.end.startOf("day").unix())return d.quick=a.range,void j();return d.quick=b,j(!0)}},k=function(){var a,b,c,e,f,g;for(d.months=[],c=12*d.range.start.year()+d.range.start.month(),b=moment().startOf("week").day(),d.range.by("days",function(a){var e,f,g,h,i,j,k;return e=a.day()-b,0>e&&(e=7+e),g=12*a.year()+a.month()-c,i=parseInt((7+a.date()-e)/7),h=!1,f=!1,d.showRanged?d.start?(h=a===d.start,f=a{{ range.start.toDate() }} - {{ range.end.toDate() }}-