角度动画流道未定义



我的角度应用程序遇到了一个非关键问题。我在表单中有一个简单的搜索字段,当我按回车键提交时,我在 angular.js 第 12007 行(AngularJS v1.4.0-rc.0)中出现异常:

TypeError: Cannot read property 'end' of undefined 
at VM2885 angular-animate.js:2209
at forEach (angular.js:332)
at closeChildAnimations (VM2885 angular-animate.js:2202)
at queueAnimation (VM2885 angular-animate.js:2048)
at Object.$$AnimateQueueProvider.$get.push (VM2885 angular-animate.js:1943)
at Object.$AnimateProvider.$get.leave (angular.js:5017)
at cleanupLastView (angular-route.js:913)
at angular-route.js:942
at publicLinkFn (angular.js:7199)
at $get.boundTranscludeFn (angular.js:7345)

原因是 angular-animate 中的 closeChildAnimations 函数.js:

function closeChildAnimations(element) {
  var node = element[0];
  var children = node.querySelectorAll('[' + NG_ANIMATE_ATTR_NAME + ']');
  forEach(children, function(child) {
    var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME));
    var animationDetails = activeAnimationsLookup.get(child);
    switch (state) {
        case RUNNING_STATE:
          //HACK: Added check here as it breaks on form submit on the search page otherwise
        if(animationDetails.runner !== undefined)
          animationDetails.runner.end();
        /* falls through */
      case PRE_DIGEST_STATE:
        if (animationDetails) {
          activeAnimationsLookup.remove(child);
        }
        break;
    }
  });
}

我添加了 if 语句作为临时黑客。似乎 activeAnimationsLookup 中的一个元素没有运行器成员。

这是应该向角度团队报告的事情,还是我在这里遗漏了什么?添加 if 语句有效,但我不高兴编辑相对稳定的框架,例如 angular。

这是

ng-animate中的一个错误,正如Phil提到的 https://github.com/angular/angular.js/issues/11658 中所讨论的那样,该错误得到了修复。

结束这个问题。

最新更新