Maarten Heideman
Maarten Heideman

Reputation: 595

Ember.js json routing not working

Try to build an ember.js based web app but it doesn't work, http://wilhelminaschool.eu/app2/

with the app js i make a route and defining an url to a json file but the template doen'st show anything, what i'am doing wrong?

Upvotes: 1

Views: 63

Answers (3)

Kingpin2k
Kingpin2k

Reputation: 47367

I'm going to piggyback on splattne's answer,

this is incorrect in your posts handlebar template

{{#each posts}}
    <li>{{title}}</li>
{{/posts}}

and should be

{{#each posts}}
    <li>{{title}}</li>
{{/each}}

you are opening and closing an each loop, and the handlebar tags need to be the same.

Upvotes: 2

kiwiupover
kiwiupover

Reputation: 1780

You have cross origin issue getting the json from the server. You need to add a header allow cross origin access to the server.

app/adapters/application.js

App.ApplicationAdapter = DS.RESTAdapter.extend({
  host: 'http://www.wilhelminaschool.eu/',
  headers: {
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Headers": "X-Requested-With"
  }
});

Upvotes: 1

splattne
splattne

Reputation: 104040

I think you misspelled some URLs in your route's model functions:

http://www.wilhelminaschool.eu/?json=get_page&page_id=10063');

Did you forget the /api segment?

and

http;//www.wilhelminaschool.eu/api/get_recent_posts');

the http://

Upvotes: 1

Related Questions