Exclude some element #2

Ganim opened this Issue Feb 10, 2017 · 1 comment


None yet

2 participants

Ganim commented Feb 10, 2017

Hi, first I have to say... Thanks, thats a Amazing Plugin!!!

So... can you add a functionality to exclude some elements By ID? exemple.. The clickOutside Element is in the center of the page.. and want to exclude the Main Toolbar.. so when I click in anywhere less the clickOutsideElement and the Main Toolbar.. I get the action. Have a way to do this ?


Hi @Ganim, thanks for your feedback. The directive emits the MouseEvent passed to it:

<my-element (clickOutside)="onClickOutside($event)"></my-element>

In your onClickOutside function, you can examine the event and the target that has dispatched it (i.e. the element has been clicked on): https://developer.mozilla.org/en-US/docs/Web/API/Event/target

onClickOutside(event: MouseEvent) {
  // if (event.target.id === '') {
  // …
  // }

Here, you could check for the ID, attributes or any other prerequisites. I think this is preferable over a general solution provided by the directive.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment