Skip to content

Instantly share code, notes, and snippets.

@EpokK
Last active December 19, 2015 23:59
Show Gist options
  • Save EpokK/6038227 to your computer and use it in GitHub Desktop.
Save EpokK/6038227 to your computer and use it in GitHub Desktop.
ng-datePicker
angular.module('myApp', []).directive('ngDatePicker', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, ctrl) {
element.datepicker({
changeYear: true,
changeMonth: true,
appendText: '(yyyy-mm-dd)',
dateFormat: 'yy-mm-dd',
onSelect: function(dateText, inst) {
scope.$apply(function() {
ctrl.$setViewValue(dateText);
});
}
});
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment