Is there a way to set focusOut in {{input}}. I just want a way to handle focusOut and it seems unnecessary that i have to create a view and extend from ember to do that. Is there any way around this?
Use case: Field validation
Is there a way to set focusOut in {{input}}. I just want a way to handle focusOut and it seems unnecessary that i have to create a view and extend from ember to do that. Is there any way around this?
Use case: Field validation
There is always a way to use jquery directly but if you want to do it The Ember way, you should create the view and use the focusOut hook.
Ok, but problem is. Extending from TextField, doesn’t bubble up events to the controller with focusOut. But extending from just a view works but requires duplicating TextFeildView into my own custom view. Any ideas on how to solve that?
Em.TextField
and Em.TextArea
are moved as components with this commit . Components
are isolated from the context controller. However you will be able to use sendAction
method to trigger an event in the context controller.
Demo Fiddle: Edit fiddle - JSFiddle - Code Playground
Hope this helps you out
Thanks a lot. Works smoothly
Actions was missing though, so i added it incase anyone stumbles on this post Edit fiddle - JSFiddle - Code Playground
There is a simple way to do this:
{{input type="text" value=text focus-out="focusOutInput"}}
and in your controller:
...
actions: {
focusOutInput: function() {
...
}
}
What if the function takes an input?
This works perfectly!