Skip to content

Instantly share code, notes, and snippets.

@bfitch
Created August 8, 2017 20:13
Show Gist options
  • Save bfitch/0005c5742edc54f83d887251fdbe262e to your computer and use it in GitHub Desktop.
Save bfitch/0005c5742edc54f83d887251fdbe262e to your computer and use it in GitHub Desktop.
New Twiddle
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
host: 'https://jsonplaceholder.typicode.com'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
export default Model.extend({
title: attr(),
body: attr(),
//user: belongsTo('user', { async: true })
});
import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
export default Model.extend({
name: attr(),
email: attr(),
address: attr(),
//posts: hasMany('post')
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.get('store').findAll('user');
}
});
<ul>
{{#each model as |post|}}
<li>{{post.title}}</li>
{{/each}}
</ul>
{
"version": "0.12.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.10.2",
"ember-template-compiler": "2.10.2",
"ember-testing": "2.10.2"
},
"addons": {
"ember-data": "release"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment