Back to Consul

on-outside

ui/packages/consul-ui/app/modifiers/on-outside.mdx

1.22.7661 B
Original Source

on-outside

{{on-outside 'click' (fn @callback}} works similarly to {{on }} but allows you to attach handlers that is specifically not the currently modified element.

hbs
<button
  {{on-outside 'click' (set this 'clicked' 'outside clicked')}}
  {{on 'click' (set this 'clicked' 'inside clicked')}}
  style="background: red;width: 100px;height: 100px;"
>
  {{or this.clicked "click me or outside of me"}}
</button>

Positional Arguments

ArgumentTypeDefaultDescription
eventstringName of the event to listen for
handlerfunctionFunction to handle the event