【发布时间】:2016-11-26 10:41:17
【问题描述】:
您好,我在前端使用 Angular JS,php 是服务层。
我正在尝试从我的网址中删除 #。
现在:http://localhost/loginwithangular/#/login
我希望看起来像:http://localhost/loginwithangular/login
我试过了:$locationProvider.html5Mode(true);但它不起作用。
请有人建议如何使它工作。
提前致谢!
【问题讨论】:
-
将此添加到您的
<base href="/" />内<head></head>标签内 -
我已经在 标签中使用了
。但仍然无法正常工作。 -
http://localhost/loginwithangular这是您的基本网址吗?我的意思是你的整个网站在http://localhost/loginwithangular内运行? -
哦,我会试试的
-
如果是,请尝试添加此代码
<base href="/loginwithangular/index.html" />或<base href="/loginwithangular/" />
标签: angularjs angular-ui-router