Specifying the URL Type Edit Page


By default the Router uses the browser's hash to load the starting state of your application and will keep it in sync as you move around. At present, this relies on a hashchange event existing in the browser.

Given the following router, entering /#/posts/new will take you to the posts.new route.

1
2
3
4
5
App.Router.map(function() {
  this.resource('posts', function() {
    this.route('new');
  });
});

If you want /posts/new to work instead, you can tell the Router to use the browser's history API.

Keep in mind that your server must serve the Ember app at all the routes defined here.

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

Finally, if you don't want the browser's URL to interact with your application at all, you can disable the location API entirely. This is useful for testing, or when you need to manage state with your Router, but temporarily don't want it to muck with the URL (for example when you embed your application in a larger page).

1
2
3
App.Router.reopen({
  location: 'none'
});