Skip to content

Instantly share code, notes, and snippets.

@courajs
Last active May 24, 2018 17:29
Show Gist options
  • Save courajs/540998d9d06aa72e746f to your computer and use it in GitHub Desktop.
Save courajs/540998d9d06aa72e746f to your computer and use it in GitHub Desktop.
Component Subexpressions one-way by default?
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
val1: 8,
val2: 8
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
<h2>This one works</h2>
{{component (component 'x-thing' val=(mut val1))}}
{{val1}}
<h2>This one doesn't</h2>
{{component (component 'x-thing' val=val2)}}
{{val2}}
<br>
<br>
{
"version": "0.6.5",
"EmberENV": {
"FEATURES": {}
},
"options": {
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.4.0/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.4.3/ember-template-compiler.js"
}
}
<button {{action (action (mut val) 10)}}>Change to 10</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment