This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See http://git.chorem.org/pollen.git commit 9fbea166bab58a974af5e20e4c7219428c98bcd8 Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Wed Aug 20 18:43:03 2014 +0200 fix autosave directive for watch ngModel --- pollen-ui-angular/src/main/webapp/js/directives.js | 33 +++++++++++----------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/js/directives.js b/pollen-ui-angular/src/main/webapp/js/directives.js index 7c4e02e..896b54f 100644 --- a/pollen-ui-angular/src/main/webapp/js/directives.js +++ b/pollen-ui-angular/src/main/webapp/js/directives.js @@ -216,13 +216,19 @@ angular.module('pollenDirective', []) }); var save = function () { - if (scope.change && !scope.lock) { - scope.$apply(function () { - scope.change = false; - scope.oldVal[attrs.ngModel] = scope.$eval(attrs.ngModel); - scope.$eval(attrs.autoSave); - }); - } + try { + scope.$digest(); + } catch (e) {} + + $timeout(function () { + if (scope.change && !scope.lock) { + scope.$apply(function () { + scope.change = false; + scope.oldVal[attrs.ngModel] = scope.$eval(attrs.ngModel); + scope.$eval(attrs.autoSave); + }); + } + }, 100); }; element.bind('change', function () { @@ -232,14 +238,6 @@ angular.module('pollenDirective', []) scope.timeout = $timeout(save,1000); }); - element.bind('dp.change', function() { - try { - scope.$digest(); - } - catch (e) { - } - }); - element.bind('dp.show', function() { scope.lock = true; @@ -628,10 +626,11 @@ angular.module('pollenDirective', []) scope.dateTimePicker.on("change", function() { var newDate = scope.dateTimePicker.data("DateTimePicker").getDate(); - if (newDate != null) { - scope.ngModel = new Date(scope.dateTimePicker.data("DateTimePicker").getDate().format()).getTime(); + if (newDate && moment(newDate).isValid) { + scope.ngModel = new Date(newDate).getTime(); } else { scope.ngModel = null; + scope.dateTimePicker.data("DateTimePicker").setDate(null); } }); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.