-
-
Save jsangilve/3d1ef5c26de1dde6bb5e to your computer and use it in GitHub Desktop.
New Twiddle
This file contains hidden or 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' | |
}); |
This file contains hidden or 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.Route.extend({ | |
mockData: Ember.on('init', function() { | |
this.store.pushPayload('person', { | |
people: [ | |
{ | |
id: 1, | |
first_name: "Tom", | |
last_name: "Dale", | |
}, | |
{ | |
id: 2, | |
first_name: "Jose", | |
last_name: "San Gil" | |
} | |
]}); | |
}), | |
model() { | |
return this.store.peekAll('person'); | |
} | |
}); | |
This file contains hidden or 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({ | |
firstName: DS.attr('string'), | |
lastName: DS.attr('string'), | |
children: DS.hasMany('person') | |
}); |
This file contains hidden or 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.RESTSerializer.extend({ | |
normalize(typeClass, hash) { | |
hash['firstName'] = hash['first_name']; | |
hash['lastName'] = hash['last_name']; | |
delete hash['first_name']; | |
delete hash['last_name']; | |
return this._super(typeClass, hash); | |
} | |
}); |
This file contains hidden or 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.10", | |
"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" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment