Hello,
I want to click a button from controller.
e.g
my html has a button:-
like this.
I want to hit button from controller.
in Jquery we can do this. $( "#target" ).click();
but how would be done by AngularJs ?.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Midhun TpRank #388 · 6.5K reputationPosted Aug 11, 2016, 6:08 AM EDT
Anand More43 reputationPosted Aug 16, 2016, 7:12 AM EDT
MayankRank #4,018 · 371 reputationPosted Nov 16, 2016, 2:14 AM EST
angular.element(document.querySelectorAll('#target')).triggerHandler('click');