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

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

问题描述

我在AngularJS项目上的网址已从 localhost:3000 / admin#/ 更改为 localhost:3000 / admin#!/ 自上次我的项目工作以来......

My URLs on an AngularJS project has 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 is this ?

推荐答案

它是AngularJS 1.6的新增功能,它添加了一个新的哈希前缀。

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


由于 aa077e8 ,用于的默认哈希前缀$ location hash-bang
网址已从空字符串('')更改为爆炸( '!')。如果您的
应用程序不使用HTML5模式或在
不支持HTML5模式的浏览器上运行,并且您没有指定自己的
哈希前缀,那么客户端URL现在将包含一个前缀。对于
示例,而不是 mydomain.com /#/ a / b / c 该URL将变为
mydomain.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('');
}]);

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

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