Last active
March 2, 2016 09:25
-
-
Save tuckbloor/9908ab0f556381bfee2f to your computer and use it in GitHub Desktop.
angular datepicker instance for multiple datepickers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html | |
<p class="input-group"> | |
<input type="text" class="form-control" datepicker-popup="{{format}}" ng-model="latestRevision(dValue).date_returned" close-text="Close" datepicker-options="datePicker.options" is-open="datePicker.instances['returned'+dValue.document_id]" /> | |
<span class="input-group-btn"> | |
<button type="button" class="btn btn-sm btn-default no-border" datepicker-options="datePicker.options" close-text="Close" ng-click="datePicker.open($event, 'returned'+dValue.document_id)"><i class="fa fa-calendar"></i></button> | |
</span> | |
</p> | |
js | |
$scope.datePicker = (function() { | |
var method = {}; | |
method.instances = []; | |
method.open = function($event, instance) { | |
$event.preventDefault(); | |
$event.stopPropagation(); | |
method.instances[instance] = true; | |
}; | |
method.options = { | |
'show-weeks': false, | |
startingDay: 0 | |
}; | |
method.format = 'dd/MM/yyyy'; | |
return method; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment