Skip to content

Instantly share code, notes, and snippets.

@bcardarella
Last active November 6, 2016 02:44
Show Gist options
  • Save bcardarella/1c3cec4a039a5a7fcebb109462c3fcb4 to your computer and use it in GitHub Desktop.
Save bcardarella/1c3cec4a039a5a7fcebb109462c3fcb4 to your computer and use it in GitHub Desktop.
block-component layout scoping
import Ember from 'ember';
export default Ember.Component.extend({
name: 'Bar'
});
import Ember from 'ember';
export default Ember.Controller.extend({
name: 'Foo'
});
<p>The value of <code>name</code> in <code>controller:application</code> is <code>"Foo"</code> and the value of <code>name</code> in <code>component:my-component</code> is <code>"Bar"</code>.</p>
<p>From <code>template:application</code>: {{name}}</p>
{{#my-component}}
Within in the block: {{name}}
{{/my-component}}
<p>{{yield}}</p>
<p>Within the component template: {{name}}</p>
{
"version": "0.10.6",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.9.0",
"ember-data": "2.9.0",
"ember-template-compiler": "2.9.0",
"ember-testing": "2.9.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment