0
<a role="button" id="trigger" class="qui-button" ng-click="ctrl.openDialog(); ctrl.triggerClick();">Confirm Dialog</a> 

I want to trigger this by pressing another button, i was using jquery to trigger the click event by:

function myFunction() { document.getElementById("trigger").click() } 

I trigger the click event, but ng-click event did not work.

How could i fix this problem?

2

1 Answer 1

1

Why don't you just have the other button with an ng-click equal to the same function?

Sign up to request clarification or add additional context in comments.

1 Comment

This is the right solution. It's pointless and confusing to force dom manipulation into your code in order to trigger a click on an element to run some behavior. It will confuse future devs, this is what ng-click is for

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.