How can I select an element in a component template?

Technology Community › Category: Angular › How can I select an element in a component template?
VietMX Staff asked 5 years ago

You can get a handle to the DOM element via ElementRef by injecting it into your component’s constructor:

constructor(myElement: ElementRef) { ... }