I'm trying to deploy my angular 2 app in a sub directory: I searched SO and google, and found I've to build it with the following command:
ng build -prod --base-href /angular-test --deploy-url /angular-test
but it's still not loading the assets.
Under networks in inspect, call to assets are going with:
/assets/i18n/en.json
whereas it should be
/angular-test/assets/i18n/en.json
Do I need to do something else? Any help is appreciated.
replace ../../../assets/images/example.jpg
to ./assets/images/example.jpg
then it worked for me.
Most of the examples I've seen are of this format:
ng build --base-href /myUrl/
So I would think you would need this:
ng build --prod --base-href /angular-test/
( With a trailing slash )
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