I am using ember cli with ember data and have been piecing together information but it still doesn't work. This all involves the Home model, route and template. I feel like I'm close but still no cigar. I took everything out except for the title to simplify it. According to documentation I've read, everything is as it should be.
here is my app.js
import Ember from 'ember';
import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
import config from './config/environment';
Ember.MODEL_FACTORY_INJECTIONS = true;
var App = Ember.Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver: Resolver
});
loadInitializers(App, config.modulePrefix);
export default App;
Here is my home model:
import DS from 'ember-data';
export default DS.Model.extend({
title : DS.attr('string'),
});
Home.reopenClass({
FIXTURES :[
{
id: 1,
title: 'Sponge B',
},
{
id: 2,
title: 'John David',
},
]
});
Here is my home route:
import Ember from 'ember';
//import DS from 'ember-data';
export default Ember.Route.extend({
model: function(){
return this.store.find('Home');
},
});
This is my home template:
<div id="home">
{{#each}}
<p>{{title}}</p>
{{/each}}
</div>
{{outlet}}
Could someone please help me out?
I think it has something to do with my model hook. Could this also be a controller issue. I generated a basic controller. Should I have generated an arrayController?. The home route when saved gives me this error message: models/home.js: line 9, col 1, 'Home' is not defined. but when I define it there still is a problem. Am I supposed to ad a folder called adapters, then put a file in it called application.js, then ad export default DS.FixtureAdapter.extend(); . But when I do that it tells me DS is not defined