Web and cordova applications both work, but it is necessary to make some manual modification after the ng build is done.
Here the situations, with the premise that when I say 'direct link' is for routes like something/:id ( with a / inside )
I've done lots of tests with different value for base href and also with no value or no tag at all, building with and without --base-href option, below a summary of considerations.
With value
<base href="/">
- WebApp: OK
- WebApp direct link: OK
- WebApp css background images: OK
- Cordova: blank screen
- Cordova css background images: ND
With value
<base href=".">
- WebApp: OK
- WebApp direct link: BROKEN
- WebApp css background images: OK
- Cordova: OK
- Cordova css background images: not displaying
In the first case the webapp is fully working, while the cordova app is broken.
So before to run "cordova run android" I need to change the the base href value from / to .
There is still a problem, all css background ( declared within components's css file ) are not displaying. To make them work I need to open the compiled 'main.xxxxxxxxxxx.js' file, find all occurrences of 'background-image:url(/' and replace with 'background-image:url(./'.
After these changes the cordova application is fully working as well.
Does anybody faced the same issue? Any solution to build the client application that is fully working in any system without modifications?
from Angular 7, cordova and base href, dot (.) and slash (/)
No comments:
Post a Comment