I am fairly new to Ember and so am probably overlooking something obvious, or making a simple error.
I am trying to build a “self-contained” view to build an understanding of the view-layer. (I’ll look at Components soon.)
The {{action}} helper can target actions which reside in the view.
E.g.,
A.MyView = Ember.View.extend({
actions: {
myViewAction: function() { console.log('H, W!'); }
}});
{{action 'myViewAction' target='view'}}
How can I call this view-residing action using the action property of a built-in helper?
E.g., Something like (does not work): {{textarea action='view.myViewAction'}}
I have tried quite a few variations on the notation for the “action= …” property.
What seems interesting is that the above ... action='view.myViewAction'
usage does not cause a “nothing handled…” failure, although the function is not called [on click; as I’d expect, as that’s the default event]. It appears that Ember is finding the action but not calling it, OR, is not finding it AND not logging the lookup failure.
If I change the code to:
{{textarea escape-press='view.myViewAction'}}
Ember will indeed log a “nothing handled…” lookup error when I press ESC.
I have a JSbin demonstrating my experiments here: http://emberjs.jsbin.com/vajajisipixi/1/
(The JSbin view has an array property of paragraphs, which can be on-click loaded into a textarea for editing. I want to update the loaded paragraph with the edited content from the textarea. I realize I could do this with a controller.)
Any advice or comments are appreciated.
Thank you, Richard