Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cordova with enabled Ember-CLI proxy suffers from hash based routing #135

Open
Awem opened this issue Apr 13, 2015 · 4 comments
Open

Cordova with enabled Ember-CLI proxy suffers from hash based routing #135

Awem opened this issue Apr 13, 2015 · 4 comments

Comments

@Awem
Copy link

Awem commented Apr 13, 2015

I'm using Ember CLI 0.2.3 with ember-cli-cordova 0.0.16. The Ember app is connected to a Rails API. Thus, I use ember server --proxy http://localhost:3000. If I set EMBER_CLI_CORDOVA=1, this changes the URLs of my app: The top route of my app is now http://localhost:4200/#/ instead of http://localhost:4200/. Under http://localhost:4200/ I now get the top route's template of the Rails app, which is equivalent to http://localhost:3000/.
So, ember-cli-cordova is changing routes. IMHO, it shouldn't do that. Is this intended?
Update:
This seems to be an effect of the ember-cli proxy (see ember-cli/ember-cli#3398). Apparently, only sub paths are properly proxied (ember-cli/ember-cli#3398 (comment)). If / is proxied, you will need a hash based routing to access it: /#/.
Ember-cli-cordova doesn't work correctly with proxy. Not only will the routes change, but now it tries to GET /cordova.js from the proxy instead of the ember host (which would be GET /#/cordova.js).

@Awem Awem changed the title Cordovy with enabled Ember-CLI proxy feature messes up URL Cordova with enabled Ember-CLI proxy feature changes routes Apr 13, 2015
@dukex
Copy link
Contributor

dukex commented Apr 13, 2015

Hi @AW-UC

Try to set defaultLocationType on your config to auto (e. g https://github.com/uhuraapp/uhura-dashboard/blob/master/config/environment.js#L8) and remove locationType config

@Awem
Copy link
Author

Awem commented Apr 13, 2015

@dukex thanks, but I already had those settings. If they are not set, ember-cli-cordova even prints an error message.

@Awem Awem changed the title Cordova with enabled Ember-CLI proxy feature changes routes Cordova with enabled Ember-CLI proxy suffers from hash based routing Apr 15, 2015
@Awem
Copy link
Author

Awem commented Apr 15, 2015

@dukex Please see the updates to my post. The problem is, that defaultLocationType is overriden by the proxy. Thus, ember-cli-cordova does not work correctly with the proxy feature for now.

@WillanTheunissen
Copy link

I am experiencing the same, any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants