|
|
@ -3,14 +3,16 @@ import { fromEvent } from 'rxjs'; |
|
|
import { SubscriptionService } from '../services/subscription.service'; |
|
|
import { SubscriptionService } from '../services/subscription.service'; |
|
|
|
|
|
|
|
|
@Directive({ |
|
|
@Directive({ |
|
|
standalone: true, |
|
|
|
|
|
selector: '[click.stop]', |
|
|
selector: '[click.stop]', |
|
|
providers: [SubscriptionService], |
|
|
providers: [SubscriptionService], |
|
|
}) |
|
|
}) |
|
|
export class StopPropagationDirective implements OnInit { |
|
|
export class StopPropagationDirective implements OnInit { |
|
|
@Output('click.stop') readonly stopPropEvent = new EventEmitter<MouseEvent>(); |
|
|
@Output('click.stop') readonly stopPropEvent = new EventEmitter<MouseEvent>(); |
|
|
|
|
|
|
|
|
constructor(private el: ElementRef, private subscription: SubscriptionService) {} |
|
|
constructor( |
|
|
|
|
|
private el: ElementRef, |
|
|
|
|
|
private subscription: SubscriptionService, |
|
|
|
|
|
) {} |
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
ngOnInit(): void { |
|
|
this.subscription.addOne(fromEvent<MouseEvent>(this.el.nativeElement, 'click'), event => { |
|
|
this.subscription.addOne(fromEvent<MouseEvent>(this.el.nativeElement, 'click'), event => { |
|
|
|