Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #19 from tommy92/callback-on-save
Browse files Browse the repository at this point in the history
Add posibility to fire callback on apply event
  • Loading branch information
Kamil Nicieja committed May 26, 2014
2 parents 886cd47 + 024e260 commit 11d0358
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-date-range-picker",
"version": "0.4.11",
"version": "0.4.12",
"authors": [
"Tymon Tobolski <[email protected]>",
"Krzysztof Jung <[email protected]>"
Expand Down
6 changes: 5 additions & 1 deletion build/angular-date-range-picker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions build/angular-date-range-picker.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-date-range-picker",
"version": "0.4.11",
"version": "0.4.12",
"authors": [
"Tymon Tobolski <[email protected]>",
"Krzysztof Jung <[email protected]>"
Expand Down
2 changes: 2 additions & 0 deletions src/angular-date-range-picker.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ angular.module("dateRangePicker").directive "dateRangePicker", ["$compile", ($co
customSelectOptions: "="
ranged: "="
pastDates: "@"
callback: "&"

link: ($scope, element, attrs) ->
$scope.quickListDefinitions = $scope.customSelectOptions
Expand Down Expand Up @@ -207,6 +208,7 @@ angular.module("dateRangePicker").directive "dateRangePicker", ["$compile", ($co
$scope.ok = ($event) ->
$event?.stopPropagation?()
$scope.model = $scope.selection
$scope.callback() if $scope.callback
$scope.hide()

$scope.select = (day, $event) ->
Expand Down
6 changes: 5 additions & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
$scope.range2 = moment().range("2012-11-15", "2012-12-25")
}

$scope.fireCallback = function() {
console.log('callback fired!');
};

$scope.date = null
})
</script>
Expand All @@ -33,7 +37,7 @@
<h1>Date range picker</h1>
<date-range-picker ng-model="range"></date-range-picker>
<pre>{{ range.start.toDate() }} - {{ range.end.toDate() }}</pre>
<date-range-picker ng-model="range2" ranged="true"></date-range-picker>
<date-range-picker ng-model="range2" ranged="true" callback="fireCallback()"></date-range-picker>
<button ng-click="change()">Change</button>
</div>
<div>
Expand Down

0 comments on commit 11d0358

Please sign in to comment.