Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert # reference in Cordova using angular js

I have a angular js application which I am trying to wrap it as a Cordova application for mobile.

The url is working fine on browser but redirection on a mobile browser has some issue. When I tried to print the absolute location of the url I am redirected to a url something like

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#/dashboard

There is a / missing from the url when the index page is called.

How can I append the / after index.html is loaded

Edit: When the app is first loaded its indicating that following file is loaded:

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#/

But what I intend to load is just

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

In config.xml I am calling

<content src="index.html" />
like image 767
Rahul Kalidindi Avatar asked Apr 25 '26 15:04

Rahul Kalidindi


1 Answers

Try,

$locationProvider.html5Mode(true)

More Information: AngularJS routing without the hash '#'

Removing the fragment identifier from AngularJS urls (# symbol)

like image 184
Vishal Rajole Avatar answered Apr 28 '26 11:04

Vishal Rajole