2017-03-08 99 views
0

我有複選框,它具有ng-click來執行一些操作。 Firefox上的問題是點擊事件被調用兩次。我的代碼是較早複選框單擊事件中的事件冒泡問題

element.click() 

的代碼修改以下後:

element.click(function (event) { 
    event.stopPropagation(); 
}); 

它開始在Firefox中工作。但它停止了所有其他瀏覽器:(

我的HTML控制

<input class="ad-ComponentListItem-checkBox" tabindex="-1"  id="AD.CPane.ComponentListItem.{{componentType}}.{{component.id}}.Checkbox" type="checkbox" 
       ng-model="component.isAddedToApp" value="{{component.id}}" 
       ng-click="componentListController.HandleComponentListSelection(component)" do-action-on-select/> 

do-action-on-select指令調用element.click()

任何幫助去什麼錯在這裏工作?

回答

0

這可能是問題與你正在使用的角度版本,試着改變你使用的角度版本,所以可能會有所幫助。

或者去檢查,以防止雙擊

Preventing multiple clicks in angularjs

+0

我都嘗試聯繫,但並沒有幫助。爲了提供更多信息,我從''keydown'''事件中調用'''element.click()'''。 – SAM