Member-only story

Auto trigger “click” event from Angular Component

Hasitha Charaka 🔵
2 min readApr 20, 2020

--

Hi Everyone,

I’m going to show how to set click event to auto trigger this work for (Angular 4+)

in here i want to trigger ‘click’ event with hidden button in HTML when the component is load.

Before starting here is my stats :

angular CLI version

Here i used “HTMLElement”,an interface from WEBApi

html :

and the component side code is here :

Walk through the Process

when the browser land to the page value is fetched using the Element ID and HTMLElement represent any element in the document and implement Event Handler Interface so now we can call “click( )” successfully.

Note : If you found a better solution then we can help each other out by sharing as…

--

--

Hasitha Charaka 🔵
Hasitha Charaka 🔵

Responses (2)

Write a response