Skip to content

Instantly share code, notes, and snippets.

@runspired
Forked from gitjeff05/application.controller.js
Last active October 28, 2015 18:24
Show Gist options
  • Save runspired/9c1517b37f44635a17c7 to your computer and use it in GitHub Desktop.
Save runspired/9c1517b37f44635a17c7 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Notifying a property change on a property passed into a child component',
description: 'There is a parent component with some buttons. When a user clicks on a button, the buttons\'s action changes the property. Since the changed property is passed into the wrapped component, you would expect that it\'s observer would fire also. But it does not. To try this, just type in 1233 and you will see that the last 3 will not render.'
});
<h1>{{appName}}</h1>
<p>{{description}}</p>
{{pin-entry}}
import Ember from 'ember';
export default Ember.Component.extend({
pinValue: '',
numbers: [1, 2, 3, 4],
actions: {
addNumber(number) {
let value = this.get('pinValue');
this.set('pinValue', value + number);
}
}
});
<input type="text" value={{pinValue}} oninput={{action (mut pinValue) value="target.value"}}>
{{#each numbers as |num|}}
<button {{action "addNumber" num}}>{{num}}</button>
{{/each}}
import Ember from 'ember';
export default Ember.Component.extend({});
{
"version": "0.4.14",
"EmberENV": {
"FEATURES": {}
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.1.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.1.0/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment