URL hash-bang (#!/) 前缀而不是 Angular 1.6 中的简单哈希 (#/) [英] URL hash-bang (#!/) prefix instead of simple hash (#/) in Angular 1.6

查看:17
本文介绍了URL hash-bang (#!/) 前缀而不是 Angular 1.6 中的简单哈希 (#/)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我上次处理我的 AngularJS 项目以来,我在 AngularJS 项目上的 URL 已从 localhost:3000/admin#/ 更改为 localhost:3000/admin#!/项目...

My URLs on an AngularJS project have changed from localhost:3000/admin#/ to localhost:3000/admin#!/ since the last time I worked on my project...

网上没有找到,有人知道这是什么吗?

Nothing found on the web, does someone know what this is ?

推荐答案

它是 AngularJS 1.6 的新特性,它添加了一个新的哈希前缀.

It is new from AngularJS 1.6, which added a new hash prefix.

由于 aa077e8$location 哈希爆炸URL 已从空字符串 ('') 更改为 bang ('!').如果你的应用程序不使用 HTML5 模式或在浏览器上运行不支持 HTML5 模式,并且您没有指定自己的hash-prefix 那么客户端 URL 现在将包含一个 ! 前缀.为了例如,URL 将变为 mydomain.com/#/a/b/cmydomain.com/#!/a/b/c.

Due to aa077e8, the default hash-prefix used for $location hash-bang URLs has changed from the empty string ('') to the bang ('!'). If your application does not use HTML5 mode or is being run on browsers that do not support HTML5 mode, and you have not specified your own hash-prefix then client side URLs will now contain a ! prefix. For example, rather than mydomain.com/#/a/b/c the URL will become mydomain.com/#!/a/b/c.

点击此处了解更多信息.

如果要删除此前缀,请将此代码添加到您的配置中:

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

这篇关于URL hash-bang (#!/) 前缀而不是 Angular 1.6 中的简单哈希 (#/)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆