Created
October 5, 2013 20:55
-
-
Save riwsky/6845895 to your computer and use it in GitHub Desktop.
a simple angularjs directive module for Keith Wood's jquery time entry (http://keith-wood.name/timeEntry.html)
This file contains hidden or 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
angular.module('jqTimeEntry', []) | |
.directive('jqTimeEntry', function () { | |
return { | |
scope: {timeModel: "="}, | |
link: function (scope, element, attrs) { | |
$(element).timeEntry({show24Hours: true, ampmNames: ['a', 'p'], | |
ampmPrefix: ' ', useMouseWheel: true, | |
showSeconds: false, timeSteps: [1, 1, 1], | |
spinnerImage: '' | |
}).change(function () { | |
scope.timeModel = $(element).timeEntry('getTime'); | |
}) | |
scope.$watch('timeModel', function (newValue, oldValue) { | |
$(element).timeEntry('setTime', newValue); | |
}) | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment