How to trigger click event manually?
问题 I am trying to trigger a document click programatically. My test-comp are shown in multiple places in a page and I want to hide them all when the test-comp is clicked or a document click is fired. @Component({ selector: 'test-comp', template: `<div *ngIf="showMe">stuff</div> and more…` }) export class TestComponent { showMenu: boolean; constructor(public elementRef: ElementRef) { } @HostListener('document:click', ['$event']) documentClick(event: MouseEvent) { //hide my component when there is