Absolutely, the approach you take depends on your strategy. One way to achieve this is through jQuery or by utilizing DOM accessors. In my experience working with a team, we prefer using JQuery, but we avoid searching the entire DOM to locate elements. Instead, we utilize a class known as ElementRef:
import { ElementRef } from '@angular/core';
...
constructor(private elementRef : ElementRef) {
}
ngAfterViewInit() {
jQuery(this.elementRef.nativeElement).find('selectModal').on('click', () => {
//perform actions here
});
}
The ElementRef class serves as a reference to the component within the DOM, allowing us to narrow down our search specifically to this component.