Skip to content

Instantly share code, notes, and snippets.

@alexlafroscia
Last active October 20, 2015 15:22
Show Gist options
  • Save alexlafroscia/b617ae5864fb3faa591c to your computer and use it in GitHub Desktop.
Save alexlafroscia/b617ae5864fb3faa591c to your computer and use it in GitHub Desktop.
Bug: Can't observe property in inner component
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Component.extend({
test: null,
testObserver: Ember.observer('test', function() {
alert('test');
})
});
{{#each test as |el|}}
{{el}}
{{/each}}
import Ember from 'ember';
export default Ember.Component.extend({
elements: ['1', '2', '3'],
actions: {
addElement() {
this.get('elements').pushObject('test')
}
}
});
<h2>Press the button, alert should be triggered</h2>
{{inner-component test=elements}}
<button {{action 'addElement'}}>Add</button>
{
"version": "0.4.13",
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.10/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.13/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.10/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment