Home > Web Front-end > JS Tutorial > body text

Why Did AngularJS 1.6 Change Hash Prefixes from \'/admin#\' to \'/admin#!/\'?

Linda Hamilton
Release: 2024-10-24 18:47:35
Original
261 people have browsed it

Why Did AngularJS 1.6 Change Hash Prefixes from

Angular 1.6 Introduces Hash-Bang Prefix (#!/) in URLs

Q: Why did my AngularJS app's URLs change from "/admin#/” to "/admin#!/"?

Since AngularJS 1.6, a new hash prefix has been added to URLs.

According to the documentation:

Due to aa077e8, the default hash-prefix used for $location hash-bang URLs has changed from the empty string ('') to the bang ('!').
Copy after login

Q: Why the change?

The hash prefix is used to differentiate AngularJS hash-bang URLs from other hash values in the URL. This helps prevent conflicts and ensures correct operation.

Q: How can I revert to the old behavior?

To remove the hash-bang prefix, add the following code to your AngularJS module configuration:

appModule.config(['$locationProvider', function($locationProvider) {
  $locationProvider.hashPrefix('');
}]);
Copy after login

The above is the detailed content of Why Did AngularJS 1.6 Change Hash Prefixes from \'/admin#\' to \'/admin#!/\'?. For more information, please follow other related articles on the PHP Chinese website!

source:php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!