angular-strap icon indicating copy to clipboard operation
angular-strap copied to clipboard

Manually typing in timepicker field throws digest errors

Open xbrabec opened this issue 12 years ago • 3 comments

Hi,

please see this plunker: http://plnkr.co/edit/AlPGUYXgUu8ysHEE5kft?p=preview

Basically, when the model is null and you try to type in the time, every keystroke generates 2 errors in the dev. console (chrome)

Honza

xbrabec avatar Jul 24 '14 14:07 xbrabec

Seems like return is missing in the parsers:

    controller.$parsers.unshift(function(viewValue) {
          // console.warn('$parser("%s"): viewValue=%o', element.attr('ng-model'), viewValue);
          // Null values should correctly reset the model value & validity
          if(!viewValue) {
            controller.$setValidity('date', true);
            return;
          }
          var parsedTime = angular.isDate(viewValue) ? viewValue : dateParser.parse(viewValue, controller.$dateValue);
          if(!parsedTime || isNaN(parsedTime.getTime())) {
            controller.$setValidity('date', false);
=====>      return;
          } else {

This way it is handled in datepicker. Putting return in the marked place fixes the issue.

Jan

xbrabec avatar Sep 15 '14 13:09 xbrabec

It relates to #623

xbrabec avatar Sep 15 '14 17:09 xbrabec

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 26 '19 17:01 lock[bot]