Skip to content

Instantly share code, notes, and snippets.

@GavinJoyce
Last active May 1, 2016 14:55
Show Gist options
  • Save GavinJoyce/8bd17b5f64fdf1f400d8 to your computer and use it in GitHub Desktop.
Save GavinJoyce/8bd17b5f64fdf1f400d8 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
componentName: 'component-one',
name: 'Ben',
actions: {
switchComponent(name) {
this.set('componentName', name);
}
}
});
<strong style="background-color: yellow">This demonstrates a bug with component positional params. Notice the `name` value isn't updated correctly</strong>
<hr />
<b>Positional:</b> {{component componentName name}} <br />
<b>Named:</b> {{component componentName name=name}}
<hr />
name: {{input value=name}}
<button {{action 'switchComponent' 'component-one'}}>Component 1</button>
<button {{action 'switchComponent' 'component-two'}}>Component 2</button>
import Ember from 'ember';
export default Ember.Component.extend().reopenClass({
positionalParams: ['name']
});
Hi {{name}} from component one
import Ember from 'ember';
export default Ember.Component.extend().reopenClass({
positionalParams: ['name']
});
Hi {{name}} from component two
{
"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"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment