URL Hash Prefix Change from # to #! in Angular 1.6
Since the latest update to AngularJS 1.6, users have noticed a shift in URL formatting. Instead of using the previous "#/" hash prefix, AngularJS now utilizes "#!/".
What's the Reason for the Change?
The change is attributed to a new hash prefix introduced in AngularJS 1.6 (aa077e8). By default, the hash-prefix for hash-bang URLs has been modified from the empty string to an exclamation point. This applies to applications that don't employ HTML5 mode or are operating on browsers that lack HTML5 mode support. In the absence of a custom hash-prefix, client-side URLs will now incorporate the "!" prefix.
Example:
A URL like "mydomain.com/#/a/b/c" will transform into "mydomain.com/#!/a/b/c".
How to Remove the Prefix
If the "!" prefix is undesirable, it can be eliminated by adding the following code to the project configuration:
appModule.config(['$locationProvider', function($locationProvider) { $locationProvider.hashPrefix(''); }]);
For more information on this subject, refer to the referenced source material.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3