EmberCLI doesn't use the # symbol anymore?

Hi guys,

I’m diving heardfirst into Ember CLI, and it seems the {{link-to}} helpers no longer link like:

foobar.com/#/friends/1

Instead it looks more traditional:

foobar.com/friends/1

Is this intentional? Where can I read more info on this?

It seems that URL format was changed: http://emberjs.com/guides/templates/links/

I’m working with ember-cli 0.0.44 and Emeber 1.7 and # symbols are working. It is a configurations issue.

If you specify locationType: 'hash' in your configuration variables it should work as expected.

Yeah, newer versions don’t use the hash anymore.

Now the question is, should you configure the locationType to use hash?

1 Like

I think it is the old problem of target browers (read IE), older versions does not support history location.

I’m wondering too if that is any better than using the hash? What are the pros and cons?

The downside of using the history location is that it requires some additional work on the backend so that refreshing your application doesn’t throw a 404. And as andosan noted before, your app won’t work for users with IE9 and below

1 Like

Would you mind clarifying, when you say History Location, are you refering to the # symbol?

History Location == # ?

The hash symbol is used by HashLocation. Take a look at this:

And if you are hosting your Ember application on S3 then hash seems like the best option. There are some ‘work arounds’ that high jack the error pages and try to serve up index, I’m not a big fan of that approach.

It’s purely a question of your preferences and deployment needs.

  • hash works everywhere, and it doesn’t depend on any server support. If you’re deploying to static hosting like Github pages or S3, it’s a good choice.

  • history makes your URLs look like “real” URLs with no #, but it requires setup on the server and some old browser’s can’t deal with it.

  • auto will use history in browsers that support it and hash in ones that don’t. This also requires server-side support, just like history.

  • none will leave the URL alone. It’s not a good idea in a normal Ember app, but it could be useful if you’re embedding an Ember app inside a larger existing site, and it’s useful in testing.

3 Likes