Home > Software engineering >  http get from assets not work in published app
http get from assets not work in published app

Time:11-03

In angular app I have assets/config.json file and I am want read file this while inialisiang app.

When run with ng serve locally I can access file with http://localhost:4200/assets/config.json

But when I hosted app in IIS on server, getting 404 error for URL http://my-web-server/assets/config.json.

When run with ng serve locally I can access file with http://localhost:4200/assets/config.json

CodePudding user response:

simply don't use full path just relative one: ../assets/config.json

CodePudding user response:

Add "assets/config.json" into your angular.json file into assets array under architect->build->options->assets

  • Related