Home >Web Front-end >JS Tutorial >How to Remove the Angular 1.6 URL Hash-Bang Prefix (#!/)?
This issue occurs due to an update introduced in AngularJS 1.6, which added a new default hash prefix. Previously, the prefix was an empty string ('') for $location hash-bang URLs, but it has now been changed to the exclamation mark ('!').
If you haven't configured your own hash prefix and your application runs in browsers that don't support HTML5 mode, URLs will now include the '!' prefix. For instance, instead of "mydomain.com/#/a/b/c," the URL will look like "mydomain.com/#!/a/b/c."
Solution:
To remove the hash-bang prefix, add the following code to your configuration:
<code class="javascript">appModule.config(['$locationProvider', function($locationProvider) { $locationProvider.hashPrefix(''); }]);</code>
The above is the detailed content of How to Remove the Angular 1.6 URL Hash-Bang Prefix (#!/)?. For more information, please follow other related articles on the PHP Chinese website!