在更新24.0.1312.52之后,chrome DateTime控件的AngularJS数据绑定不起作用

Sut*_*bey 6 javascript google-chrome angularjs

希望其他人也观察到这一点: -

我们使用AngularJS 1.0并使用type ="date"with element来获取Chrome的不错的默认日期时间选择器.一切都工作正常,直到chrome最近更新到[24.0.1312.52].现在如果我使用datetime选择器更改日期,AngularJS数据绑定不会将其保存为绑定$ scope的json属性.

如果我通过任何键盘键更改日期,数据绑定将日期保存到属性绑定.

可能是造成这个问题的原因.

Sut*_*bey 2

我们在 angularJS 谷歌小组中获得了帮助:-

https://groups.google.com/forum/?fromgroups=#!topic/angular/ycYzD3xRKS8

JSFeedle 作者:Peter Bacon Darwin

http://jsfiddle.net/ZsRxj/

var module = angular.module('demoApp',[]);

module.directive('input', function () {
  return {
    require: '?ngModel',
    restrict: 'E',
    link: function (scope, element, attrs, ngModel) {
      if ( attrs.type="date" && ngModel ) {
        element.bind('change', function () {
          scope.$apply(function() {
            ngModel.$setViewValue(element.val());
          });
        });
      }
    }
  };
});
Run Code Online (Sandbox Code Playgroud)