I have an Angular application set up to run in a virtual directory. (https://{url}/{virtualDirectory}
)
I'm trying to wrap this application in a Cordova application that will point to a URL as the content source. (<content src="https://{url}/{virtualDirectory}"/>
)
In my index.html file, I added the cordova.js
script. (<script src="cordova.js"></script>
)
My problem seems to be that Angular Router is getting in the way. When I debug the application I see the following console error:
caught Syntax error: unexpected token '<' at cordova.js:1:1
When I look at the source code I see that the Angular application's 404 page is rendered, so the Angular routing is trying to handle this path.
When we build and deploy in a Docker configuration we are setting the baseHref
because we have to use a virtual folder:
ng build --base-href /{virtualDirectory}/ --configuration=$environment --output-path=dist
Rendered as <base href="/{virtualDirectory}/">
in the actual web page.
I tried googling this problem and couldn't find any suggestions on how to fix this (or at least none that worked). Can someone help point me in the right direction? TIA.
I also encountered this problem when publishing on a virtual directory on the Apache server. What I followed is the following:
D:\some-path\project-name\audience
https://your-web-name/audience/d63b643da9b9cfc65e7d304b0aa33c98
ng build --base-href ./ --deploy-url ./
(Note: This command will only work if you follow point 1 correctly)