How to prevent double click in Angular?
问题 I have a component with click . <my-box (click)="openModal()"></my-box> When I click this element, openModal function will run. And I'd like to give 1000ms throttle time in order to prevent opening multiple modals. My first approach was using Subject (from rxJs) //html <my-box (click)="someSubject$.next()"></my-box> //ts public someSubject$:Subject<any> = new Subject(); ...etc subscribe But I feel it's a bit verbose. Next Approach was using a directive . I modified a bit of code that I found