Question

I must be doing something wrong. I have a simple app served with Rails with the following:

App.Router.reopen({
  location: 'history'
});

App.Router.map(function() {
  this.resource('news')
});

When I enter the app at the root URL and use a {{#linkTo}} to transition to the news route, everything works fine. The URL updates to /news.

But when I try to go directly to /news, Rails gives me a 404 error because I don't have the news route defined in Rails (obviously).

I've read through some of the issues on the Ember repo, searched discuss.emberjs.com and read the guides, the inline documentation and the API for Ember.Location and it is not obvious to me how to make this work or if it is even supposed to work like I expect.

What am I missing?

Était-ce utile?

La solution

You have to render the same HTML page at every URL that is part of the ember app.

Here's an example: What should my Rails routes look like to work with pushState Ember.js routes?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top