我有一个 angular js 应用程序,我试图将其包装为移动的 Cordova 应用程序。
该网址在浏览器上运行良好,但在移动浏览器上的重定向存在一些问题。当我尝试打印 url 的绝对位置时,我被重定向到类似
的 urlfile:///Users/mac/Library/Developer/CoreSimulator/Devices/69F93249-284F-4F04-82CA-14B111CCA50F/data/Containers/Bundle/Application/B21EB426-7066-4425-82F0-6F73736D880C/ClientManagement.app/www/index.html#/dashboard
调用index页面时,url中少了一个/
。
如何在加载 index.html 后附加 /
编辑:首次加载应用程序时,它指示加载了以下文件:
file:///Users/mac/Library/Developer/CoreSimulator/Devices/69F93249-284F-4F04-82CA-14B111CCA50F/data/Containers/Bundle/Application/B21EB426-7066-4425-82F0-6F73736D880C/ClientManagement.app/www/index.html#/
但是我打算加载的只是
file:///Users/mac/Library/Developer/CoreSimulator/Devices/69F93249-284F-4F04-82CA-14B111CCA50F/data/Containers/Bundle/Application/B21EB426-7066-4425-82F0-6F73736D880C/ClientManagement.app/www/index.html
我在config.xml中调用
<content src="index.html" />
最佳答案
尝试,
$locationProvider.html5Mode(true)
更多信息: AngularJS routing without the hash '#'
Removing the fragment identifier from AngularJS urls (# symbol)
关于angularjs - 如何使用angular js在Cordova中插入#reference,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34352650/