Exploring ember-data
Ember-data was a big struggle when I first started to learn EmberJs. Let's explore ember-data through some living and breathing examples using JsonStub and ember-data's RESTAdapter.
Get some records
Usually, the first thing we need to be able to do is retrieve a list of records. Let's get a list of project models that makes use of every attribute type ember-data has to offer. Click on the Projects link below to go to the projects route to get the models. You can then click on a project to visit the project.
Here's what the json being returned looks like. Pretty straight-forward stuff.
{
"projects": [
{
"id": 1,
"title": "Develop Awesome Feature",
"participantCount": 5,
"created": "2014-11-12T15:30:00",
"public": true
},
{
"id": 2,
"title": "Squash Annoying Bug",
"participantCount": 2,
"created": "2014-11-15T08:45:00",
"public": false
}
]
}
Tip! The bins too small? Just click on the JS Bin link in the top left of a bin to open it up in a new tab. Once you've done that, you can see the *actual* http requests being made by opening your browser's developer console.
Categories: Javascript