@ofridagan wrote:
Up until Ember 1.12 I have been using the following for sending actions to components: (taken from: http://blog.planetargon.com/entries/2015/4/8/helpful-pattern-for-sending-actions-to-your-ember-components)
MyComponent = Ember.Component.extend({ _register: function() { this.set('register-as', this); }).on('init') });
Then, I can use it in templates:
{{my-component register-as=eventsListener}}
and somewhere in a controller for example...
this.get('eventsListener').send('myAction');
In Ember 1.13 I'm getting strange results. I couldn't figured out exactly what's happening, but eventsListener sometimes does get updated.
I also tried different "lifecycle hooks" like: 'didInitAttrs', etc.. with same results. 'didInsertElement' does work, (with warning) but it feels very wrong.
What is a good way to achieve this? Is this a bad pattern?
Posts: 5
Participants: 2