How to use ember data model to fetch data from a json file and display in template

I need help in 1, how ember model is connected with model() hook in router.js 2, how we can save and retrieve data from json file using ember model. 3, where we need to specify the url of json file. 4, do I need to create a JsonAPIAdapter for it using cli.

I guess you would just request the data via ajax (e.g. Ember.$.getJSON('/my-data.json')) and then push it manually into the store: Pushing Records into the Store - Models - Ember Guides

Or, if you want to use ember data, override the specific urlForXXX method in either the application adapter or a model specific adapter.

For example, if you have a file posts.json in your public directory which you want returned from store.findAll('post'), do this:

// adapters/post.js
export default ApplicationAdapter.extend({
  urlForFindAll(modelName) {
    return 'posts.json';
  }
});

Am getting this error

test-app@model:todo::ember441:1

test-app@model:todo::ember442:2

test-app@model:todo::ember443:3

when i used

urlForFindRecord(todo) { return ‘todos.json’; }

whoops, I copied the wrong one. it should be urlForFindAll. I modified my original response,

I did the same . but data is not showing.

Brother I dont have previous experience in any javascript framework.

How could I learn all the functionalities of ember with a simple backend.

what is adapters used for.

how do i have to configure my ember app with any of database(I mean sample data to work).

I am using ember cli

how can i create a simple form using ember and save form data to my local.

can you post on github?

I dont know how to use github

Can I write actions inside model() hook of router

like

model() {

return $.json();

actions: {

x(): {}, y(): {}

} }