I'm trying to get to work EmberCLI frontend app with my Rails API. For some reason it does not work. When I visit 'localhost:4200/artists' I see nothing but h1 tag. No API data. JS Console is empty. Any ideas?
Here's my adapter:
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr('string'),
itunes_id: DS.attr('integer'),
});
Model:
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr('string'),
itunes_id: DS.attr('integer'),
});
Router:
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route('artists');
});
export default Router;
Route:
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.store.findAll('artist');
}
});
And view:
<h1> Artists </h1>
<ul>
{{#each artists as |artist|}}
<li>Hello, {{artist.name}}!</li>
{{/each}}
</ul>
Aucun commentaire:
Enregistrer un commentaire