Skip to content

Instantly share code, notes, and snippets.

@tlrjs
Last active May 12, 2016 20:42
Show Gist options
  • Save tlrjs/9aa54ac59de597f1ae520077d605aab0 to your computer and use it in GitHub Desktop.
Save tlrjs/9aa54ac59de597f1ae520077d605aab0 to your computer and use it in GitHub Desktop.
Dynamic Component Rendering
import Ember from 'ember';
export default Ember.Component.extend({
componentNameWithAttr: Ember.computed(function() {
return 'sub-component subComponentAttr1="hello"';
}),
componentName: Ember.computed(function() {
return 'sub-component';
})
});
import Ember from 'ember';
export default Ember.Component.extend({
subComponentAttr1: 'text inside of sub component',
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
Hello {{my-component}}
<br>
<br>
This is the subcomponent: {{subComponentAttr1}}
{
"version": "0.8.1",
"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.5.1",
"ember-data": "2.5.2",
"ember-template-compiler": "2.5.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment