Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember input blur action

How can i trigger an action on input blur, this is what i have tried.

{{input class="form-control" action="validateEmail" onEvent="onBlur"}}
{{input class="form-control" action="validateEmail" onEvent="blur"}}
{{input class="form-control" action="validateEmail" onEvent="focusOut"}}

They all only trigger on enter

like image 386
iConnor Avatar asked Dec 11 '13 09:12

iConnor


2 Answers

You can use the focus-out

{{input type="text" value=text focus-out="doAction"}}

Give a look in that fiddle http://jsfiddle.net/marciojunior/977xj/

like image 107
Marcio Junior Avatar answered Oct 21 '22 06:10

Marcio Junior


To pass arguments to an action, you can use closure action syntax:

{{input focus-out=(action "doSomething" "someArgument")}}
  • http://emberjs.com/blog/2015/06/12/ember-1-13-0-released.html#toc_closure-actions
  • http://alexdiliberto.com/posts/ember-closure-actions/

(would've added this as a comment, but I don't have enough reputation yet)

like image 31
Andrius Avatar answered Oct 21 '22 07:10

Andrius