Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up ember.js to use history when the app is in a sub directory of my server

So I'm trying to get ember to use the history api for it's routing to get rid of the hashbangs. But when I use

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

I get the following error

Assertion failed: The URL '/ember-store/' did not match any routes in your application

I'm using MAMP for my localhost server and all the projects are just sub folders in the htdocs folder. The folder that the whole app and index.html files for this ember.js app are in is called "ember-store". How do I fix this issue so I can use the history API correctly?

like image 610
Jordan Avatar asked Dec 07 '25 11:12

Jordan


1 Answers

If you want your Ember app to route within a path segment, you need to tell the Ember Router what your root URL is. To do this in your case, change your code above to:

App.Router.reopen({
    location: 'history',
    rootURL: '/ember-store/'
});

http://emberjs.com/guides/routing/#toc_specifying-a-root-url

like image 60
joegoldbeck Avatar answered Dec 09 '25 20:12

joegoldbeck



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!