I am developing an application using Angular 2 with cordova. I have used the angular cli to build the appplication. I have now ran into some routing issues on startup when it comes to the IOS application. The base href seems to be set wrong. If I set the base href using: <base href="/" target="_blank">
the application doesn't load. If the base href is set when I bootstrap the application using: ...,provide(APP_BASE_HREF, {useValue:'/'}), ...
the application will load but I get the following exception:
EXCEPTION: Error: Uncaught (in promise): Error: Cannot match any routes: 'var/containers/Bundle/Application/3C8966ED-7DDD-4309-8C18-10B778C5AE15/test.app/www'
So the application can't function properly since there are critical files that don't get loaded on the start of the application. For android I encountered the same problem but I found the solution, to set the base href in the following question android solution. Have anybody encountered this problem and have a solution?
Edit: I solved the problem by using this: <base href="./" target="_blank">
in index html and remove the provide(APP_BASE_HREF, {useValue:'/'})
. This way I have to set change the base href depending if I'm deploying the app to android or ios.
I set it as
<base href="www">
and all css, js and images file loading are correct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With