Hello. I need to take data from JSON api. but I cant. Where am I supposed to write the url and how am I call it as a store from the route? I have a model, I wrote the attributes I need in it as DS.attr() , created an adapter “application.js” and wrote
import JSONAPIAdapter from 'ember-data/adapters/json-api';
import Ember from 'ember';
export default JSONAPIAdapter.extend({
find: function(){
return Ember.$.getJSON('http://api.donanimhaber.com/api/v1/site/NewsSite?pageIndex=0&pageSize=15');
}
});
also I tried to call the store as
import Ember from 'ember';
export default Ember.Route.extend({
model(){
return this.store.findAll('news-list');
}
});
Because my model’s name is news-list.
But it doesn’t work. I see a blank page and chrome devTools says
Ember Data Request GET /news-lists returned a 404
Payload (text/html; charset=utf-8)
Cannot GET /news-lists
What is wrong here?
Also my index.hbs
{{image-list model=model currentPos=currentPos }}
{{outlet}}
because I have a component image-list which is
{{#each model as |pic|}}
<div>{{#link-to "pic" pic}}
<p class="info">{{pic.Title}}</p><br/>
<img src={{pic.Image}} width="300">
{{/link-to}}</div>
{{/each}}
{{yield}}