Created
June 13, 2016 22:49
-
-
Save ruohki/48bf02c75995f17c9187cfdb3fd55df9 to your computer and use it in GitHub Desktop.
problem
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
//app/adapters/application.js | |
import JSONAPIAdapter from 'ember-data/adapters/json-api'; | |
export default JSONAPIAdapter.extend({ | |
namespace: 'api', | |
host: 'https://community-ruohki.c9users.io' | |
}); |
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
//app/controllers/task.js | |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
model: function(params) { | |
console.log("fetching task..."); | |
this.store.findRecord('task', 1).then(function(task) { | |
return task; | |
}); | |
} | |
}); |
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
//app/models/task.js | |
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('string'), | |
description: attr('string'), | |
date: attr('date'), | |
created: attr('string', { | |
defaultValue: function() { | |
return new Date(); | |
} | |
}) | |
}); |
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
//app/templates/task.hbs | |
<h1>Tasks</h1> | |
{{outlet}} | |
{{#each model as |item|}} | |
{{item.content}} | |
{{/each}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment