How to get mouseup outside of the component in Angular 2

后端 未结 4 1884
一生所求
一生所求 2021-01-12 01:03

I have a abc component (part of the page). It has an event mouseup.

@Component({
    selector: \'abc-component\'
})
@View({
    
4条回答
  •  被撕碎了的回忆
    2021-01-12 01:15

    Add a global event target like

    to listen to events globally. (body and document work as well).

    This works of course also in the components class

    @HostListener('window:mouseup', ['$event'])
    mouseUp(event){}
    

提交回复
热议问题