[英]Angular : Click Binding is not Working on Dynamic Invoking Click Event anchor Tag
I got a problem with Angular(2+), I have a menu with anchor tag, we manually select menu item or through keyboard Enter we select the menu item. 我遇到了Angular(2+)的问题,我有一个带有定位标记的菜单,我们手动选择菜单项,或者通过键盘Enter选择菜单项。
<a (click) = 'selectItem(item)' id='menuItem1'>Menu item</a>
Through Enter, dynamically calling the click event on anchor tag. 通过Enter键,动态调用锚标记上的click事件。
$('#menuItem1').click();
Expecting that menu has to select, but not selected. 期望该菜单必须被选中,但是未被选中。 Other than anchor tag, on Enter menuitem is selected. 除锚标记外,在Enter菜单项上也被选中。
Sample Code : https://plnkr.co/edit/lZX86z7xIBdrvI9lNEFO?p=preview 示例代码: https : //plnkr.co/edit/lZX86z7xIBdrvI9lNEFO?p=preview
Please help me. 请帮我。
Question : 题 :
1) Why Jquery click is not working on anchor tag along with angular bindings? 1)为什么Jquery click不能与角度绑定一起在锚标记上使用? 2) Why working for other tags (than anchor tag)? 2)为什么要使用其他标签(而不是锚标签)?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.