NG-鼠标按下处理程序连接到NG-鼠标松开的事件 [英] ng-mousedown handler attaching to ng-mouseup's event
问题描述
我想使用 NG-鼠标按下
和 NG-鼠标松开
的演唱会,但 NG-鼠标按下
被射击两次, NG-鼠标松开
不点火的。例如,下面的code使计数
由两个递增在preSS往上走,而不是上下对发布:
I am trying to use ng-mousedown
and ng-mouseup
in concert, however ng-mousedown
is firing twice and ng-mouseup
is not firing at all. For example, the following code causes count
to increment by two instead of going up on press and down on release:
<!DOCTYPE html>
<html>
<body ng-app>
<div>
<div style="background-color: blue; width: 80px;" ng-mousedown="count = count + 1" ng-mouseup="count = count - 1" ng-init="count=0">Click Me</div>
<div>{{count}}</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
</body>
</html>
如果我改变角度版本1.1.1它按预期工作。我做得不对,或这是角中的错误?我在Chrome和Firefox的测试。它工作在Firefox,而不是浏览器。
If I change the Angular version to 1.1.1 it works as expected. Am I doing something wrong or is this a bug in Angular? I've tested in Chrome and Firefox. It works in Firefox, but not Chrome.
更新:经过进一步的测试看来,这可能不仅不能在Chrome工作在Linux 64.因此,它可能是浏览器的错误
Update: After further testing it appears that this may only fail to work in Chrome on Linux 64. So it might be a bug in Chrome.
推荐答案
我直接加载测试文件到Chrome浏览器,发现它工作作为预期。当我将它比作通过我的本地网络服务器中加载的一个,我发现注射到我的HTML以下行:
I loaded the test file into Chrome directly and found it worked as expect. When I compared it to the one loaded via my local webserver, I found the following line injected into my HTML:
<div id="__ngBatarangElement" style="display: none;">{"id":1,"time":18.12599998083897,"event":"scope:apply"}</div>
这让我怀疑在开发工具的AngularJS标签。果然,禁用它固定的页面:
That made me suspect the AngularJS tab in dev tools. Sure enough, disabling it "fixed" the page:
什么是更令人不安的是,我清楚地记得选择不安装Batarang由于几乎普遍负面评价。我想我将不得不矿山添加到一堆。
What is more disconcerting is the fact that I distinctly remember choosing not to install Batarang due to the nearly universal negative reviews. I guess I will have to add mine to the pile.
更新:发现这个问题已经被报告的https: //github.com/angular/angularjs-batarang/issues/205
Update: Found that the issue has been reported https://github.com/angular/angularjs-batarang/issues/205
这篇关于NG-鼠标按下处理程序连接到NG-鼠标松开的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!