Last active
July 26, 2016 14:24
-
-
Save zkwentz/89a5c99aad0bfd874ffc4ccbfae0507f to your computer and use it in GitHub Desktop.
Difference in Promised Properties
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.FixtureAdapter.extend({}); |
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', | |
comments: Ember.computed('model.comments',function(){ | |
return this.get('model.comments'); | |
}), | |
resolvedComments: Ember.computed('model.comments',{ | |
get(key) { | |
this.get('model.comments').then(function(_this) { | |
return function(comments) { | |
_this.set('resolvedComments',comments); | |
return; | |
}; | |
}(this)); | |
return false; | |
}, | |
set(key,value) { | |
return value; | |
} | |
}) | |
}); |
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"; | |
var Comment = DS.Model.extend({ | |
body: DS.attr('string'), | |
author: DS.attr('string'), | |
post: DS.belongsTo('post',{async:true}) | |
}); | |
Comment.reopenClass({ | |
FIXTURES: [ | |
{ | |
id: 1, | |
author: "Zach Wentz", | |
post: 1, | |
body: "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium aspernatur quam qui commodi beatae placeat ducimus aliquam veritatis ullam sed! Sit assumenda aspernatur sunt harum accusamus, repellat labore! Repellendus, corporis!" | |
}, | |
{ | |
id: 2, | |
author: "Ryan Christiani", | |
post: 1, | |
body: "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium aspernatur quam qui commodi beatae placeat ducimus aliquam veritatis ullam sed! Sit assumenda aspernatur sunt harum accusamus, repellat labore! Repellendus, corporis!" | |
}, | |
{ | |
id: 3, | |
author: "Ryan Christiani", | |
post: 1, | |
body: "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium aspernatur quam qui commodi beatae placeat ducimus aliquam veritatis ullam sed! Sit assumenda aspernatur sunt harum accusamus, repellat labore! Repellendus, corporis!" | |
} | |
] | |
}); | |
export default Comment; |
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"; | |
var Post = DS.Model.extend({ | |
title: DS.attr('string'), | |
body: DS.attr('string'), | |
author: DS.attr('string'), | |
comments: DS.hasMany('comment',{async:true}) | |
}); | |
Post.reopenClass({ | |
FIXTURES: [ | |
{ | |
id: 1, | |
title: "Using Ember CLI to create a Fixture Adapter.", | |
author: "Zach Wentz", | |
comments: [1,2,3], | |
body: "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium aspernatur quam qui commodi beatae placeat ducimus aliquam veritatis ullam sed! Sit assumenda aspernatur sunt harum accusamus, repellat labore! Repellendus, corporis!" | |
}, | |
{ | |
id: 2, | |
title: "Ember is lots of fun", | |
author: "Ryan Christiani", | |
body: "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium aspernatur quam qui commodi beatae placeat ducimus aliquam veritatis ullam sed! Sit assumenda aspernatur sunt harum accusamus, repellat labore! Repellendus, corporis!" | |
}, | |
{ | |
id: 3, | |
title: "Ember, Node, Express and You!", | |
author: "Ryan Christiani", | |
body: "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium aspernatur quam qui commodi beatae placeat ducimus aliquam veritatis ullam sed! Sit assumenda aspernatur sunt harum accusamus, repellat labore! Repellendus, corporis!" | |
} | |
] | |
}); | |
export default Post; |
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.Route.extend({ | |
store: Ember.inject.service(), | |
model(params) { | |
return this.get('store').find('post',1); | |
} | |
}); |
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.9.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.6.0", | |
"ember-data": "1.13.15", | |
"ember-template-compiler": "2.6.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment