Updated datepicker

This commit is contained in:
Luke Vella 2015-02-02 17:45:38 +01:00
parent 5a99b705d2
commit 49f0c92015
12 changed files with 75 additions and 38 deletions

View file

@ -141,7 +141,7 @@ angular.module('rallly')
}
}
})
.directive('timePicker', function(){
.directive('timePicker', function($timeout){
return {
scope : {
model : '=ngModel'
@ -149,9 +149,12 @@ angular.module('rallly')
require : 'ngModel',
link : function(scope, el, attrs, ngModel){
ngModel.$viewChangeListeners.push(function(){
scope.model = Date.parse(ngModel.$modelValue);
ngModel.$setViewValue(scope.model.toString("hh:mm tt"));
ngModel.$render();
scope.model = ngModel.$modelValue;
});
ngModel.$parsers.push(function (value) {
if (!value) return;
return Date.parse(value);
});
ngModel.$validators.time = function(modelValue, viewValue){