AngularJS "#!" by URL

someone knows that "#!" It means. on the url?

I worked until it appeared, I had a "#" always in the URL and would like to save it that way. Routing no longer works, possibly due to this URL change.

This is part of a business project, I do not want to change html5Mode.

I tried using:

$locationProvider.hashPrefix(""); 

Even if the URL is corrected, there are problems in this route.

+7
angularjs web hash routing
source share
3 answers

Thats called hash-bang .

To fix this usage:

  angular.module('yourApp', []) .config(['$locationProvider', function($locationProvider) { $locationProvider.hashPrefix(''); }]); 

Adding html5Mode will even save you from the "#" in the URL, but if you refresh the page you will get a 404 error. This can be fixed by setting up the server a bit. To do this, you may need to familiarize yourself with small tutorials:

There is another answer to the hashbang problem in stackoverlow:

Follow links like Twitter, Hash-Bang #! Url

+6
source share

You can use html5Mode in your location provider.

 $locationProvider.html5Mode(true); 

more details https://scotch.io/tutorials/pretty-urls-in-angularjs-removing-the-hashtag

0
source share

Set html5mode true to app.config

 $locationProvider.html5Mode(true).hashPrefix('*'); 
0
source share

All Articles