Orca Prime
Orca Prime

Reputation: 165

Why does /#!/ appear on address bar?

Hi I've been studying angular 1.5 and using this course

https://thinkster.io/angularjs-es6-tutorial

I've cloned the repo to help me get started and while following the video tutorial, I noticed that my address bar was looking something like this:

http://localhost:4000/#!/

whereas the developer doing the tutorial had /#/ in his address bar.

Why is this the case?

Also im getting these angular ui-router errors:

Error: transition superseded
Error: transition prevented
Error: transition aborted
Error: transition failed

Anyone have an idea?

Upvotes: 2

Views: 294

Answers (1)

Leon Radley
Leon Radley

Reputation: 7682

The /#!/ is angular's $location service doing.

Before history.pushState https://developer.mozilla.org/en-US/docs/Web/API/History_API

We (The web community) did a workaround where we tracked the window.location.hash most notably twitter.com. now a days http://caniuse.com/#feat=history is supported by all browsers.

So I would suggest to enable html5Mode to use the new history API, which will remove the /#!/ https://docs.angularjs.org/guide/$location#hashbang-and-html5-modes

Upvotes: 2

Related Questions