thortineoc
thortineoc

Reputation: 1

What is the safest way to perform an event from code in Angular?

When some data arrives from an API I need to perform a click event in my Angular app. It has to be done from typescript code. I use a component from an external library and it is the only way to make it work as I need.

I used ViewChild as ElementRef. Then called click() on the native element of this elementRef, but I read everywhere that it's unsafe. I also read about using Renderer2 instead, but it is able to change only reaction to events or style of the DOM element.

So is there any better way of doing that?

Upvotes: 0

Views: 60

Answers (0)

Related Questions