Angular : Click Binding is not Working on Dynamic Invoking Click Event anchor Tag

40 views
Skip to first unread message

Subbu S

unread,
Jan 30, 2018, 8:32:39 AM1/30/18
to Angular and AngularJS discussion

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.

<a (click) = 'selectItem(item)' id='menuItem1'>Menu item</a>

Through Enter, dynamically calling the click event on anchor tag.

$('#menuItem1').click();

Expecting that menu has to select, but not selected. Other than anchor tag, on Enter menuitem is selected.

Sample Code : https://plnkr.co/edit/lZX86z7xIBdrvI9lNEFO?p=preview

Please help me.

Reply all
Reply to author
Forward
0 new messages