Last active
November 10, 2015 19:57
-
-
Save nolan/d4e5f71039d656c29133 to your computer and use it in GitHub Desktop.
Child Component Render
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle', | |
widgets: function(){ | |
return this.get('store').peekAll('widget'); | |
}.property(), | |
actions: { | |
addWidget: function(){ | |
let newId = this.get('widgets').get('length')+1; | |
this.get('store').push({data: {id: newId, type: 'widget', attributes: {type:'Test Widget '+newId}}}); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
export default DS.Model.extend({ | |
type: DS.attr('string') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.4.16", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.1.0", | |
"ember-data": "2.1.0", | |
"ember-template-compiler": "2.1.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
store: Ember.inject.service(), | |
widgets: function(){ | |
Ember.Logger.debug('Peeking at some widgets'); | |
return this.get('store').peekAll('widget'); | |
}.property(), | |
didRender: function(){ | |
Ember.Logger.debug('Rendering Widget List'); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
didRender: function(){ | |
Ember.Logger.debug('Rendering Widget:', this.get('widget.type')); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment