Example of using the same template between two components.
View Twiddle | Copy Twiddle | View Gist
Original idea of this README taken from @rwjblue
Example of using the same template between two components.
View Twiddle | Copy Twiddle | View Gist
Original idea of this README taken from @rwjblue
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| appName:'Sharing templates between components' | |
| }); |
| import Ember from 'ember'; | |
| export default Ember.Component.extend({ | |
| }); |
| import Ember from 'ember'; | |
| import layout from '../first-component/template'; | |
| export default Ember.Component.extend({ | |
| layout: Ember.computed(function() { | |
| //One way is by importing the template and the | |
| //other way is by using templateForName | |
| return layout; | |
| //return this.templateForName('first-component') | |
| }) | |
| }); |
| { | |
| "version": "0.4.11", | |
| "dependencies": { | |
| "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
| "ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.10/ember.debug.js", | |
| "ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.13/ember-data.js", | |
| "ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.10/ember-template-compiler.js" | |
| } | |
| } |