Skip to content

Instantly share code, notes, and snippets.

@menacestudio
Created March 13, 2015 21:39
Show Gist options
  • Save menacestudio/782e9df7b4156a0b9aeb to your computer and use it in GitHub Desktop.
Save menacestudio/782e9df7b4156a0b9aeb to your computer and use it in GitHub Desktop.
An AngularJS decorator directive to apply automatic formatting to Angular UI datepickers.
function datepickerPopup() {
return <ng.IDirective>{
restrict: 'EAC',
require: 'ngModel',
link: function ($scope, $element, $attrs, controller) {
controller.$formatters.shift();
}
}
}
angular.module('app').directive('datepickerPopup', datepickerPopup);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment