javascript - Ember Data error while processing route this.store.findALL is not a function -
i'm going through ember.js guides, , i'm getting hung on ember data section. ember data guide
the tutorial shows how create ember data model , use in conjunction mirage render basic rentals info on index page.
my code appears same tutorial (see note @ bottom), index page doesn't display anything, , these errors in chrome console:
any offer appreciated.
app/models/rentals.js
import model 'ember-data/model'; import attr 'ember-data/attr'; export default model.extend({ title: attr(), owner: attr(), city: attr(), type: attr(), image: attr(), bedrooms: attr() });
app/mirage/config.js
export default function() { this.get('/rentals', function() { return { data: [{ type: 'rentals', id: 1, attributes: { title: 'grand old mansion', owner: 'veruca salt', city: 'san francisco', type: 'estate', bedrooms: 15, image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/crane_estate_(5).jpg' } }, { type: 'rentals', id: 2, attributes: { title: 'urban living', owner: 'mike teavee', city: 'seattle', type: 'condo', bedrooms: 1, image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/alfonso_13_highrise_tegucigalpa.jpg' } }, { type: 'rentals', id: 3, attributes: { title: 'downtown charm', owner: 'violet beauregarde', city: 'portland', type: 'apartment', bedrooms: 3, image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/wheeldon_apartment_building_-_portland_oregon.jpg' } }] }; }); }
app/routes/index.js
import ember 'ember'; export default ember.route.extend({ model() { return this.store.findall('rental'); } });
app/templates/index.hbs
<h3>welcome super rentals</h3> <p> dedicated helping you! </p> {{#each model |rental|}} <h2>{{rental.title}}</h2> <p>owner: {{rental.owner}}</p> <p>type: {{rental.type}}</p> <p>location: {{rental.city}}</p> <p>number of bedrooms: {{rental.bedrooms}}</p> {{/each}} {{#link-to "about"}}about us!{{/link-to}} {{#link-to "contact"}}contact us!{{/link-to}} {{outlet}}
note-- ember.js guide out of date current version of ember, i'm using these edits ember-data.md file.
well, store.findall
not store.findall
! javascript case sensitive.
Comments
Post a Comment