Tom
Tom

Reputation: 950

Redirect URLs without hashbang to URLs with hashbang using AngularJS

Since upgrading to AngularJS 1.6, hashbangs are defaulted.

How would I redirect formerly distributed URLs to transform to a version with the hashbang?

For example www.myu.rl/#/hello/ would then become www.myu.rl/#!/hello

Currently it navigates to www.myu.rl/#!#%2F/hello, which redirects to the home page.

Upvotes: 0

Views: 496

Answers (1)

Mistalis
Mistalis

Reputation: 18289

If you want to keep the hash-bang mode (#!/), then set your hash-prefix to:

$location.hashPrefix('!');

If you would like to go back to the good ol' days, see this answer.

Upvotes: 0

Related Questions