'ng build --prod --base-href
ng build --prod --base-href /gi-new --deploy-url /gi-new
I deployed angular 5 app to shared IIS server on window machine
I have uploaded contents of my dist folder to http://192.168.10.181/gi-new
My app runs but the icons which are in assets are not picking correct path so they do not show on the web page.
they are using http://192.168.10.181/assets instead of /gi-new/assets
entries in angular-cli.json
"assets": [ {
"glob": "*.svg",
"input": "../node_modules/material-design-icons/sprites/svg-sprite/",
"output": "assets/svg-icons"
}]
entries in AppComponent
constructor(iconRegistry: MatIconRegistry, sanitizer: DomSanitizer) {
iconRegistry.addSvgIconSetInNamespace
( "action", sanitizer.bypassSecurityTrustResourceUrl("assets/svg-icons/svg-sprite-action.svg"));
How can I overcome this issue ?
Solution 1:[1]
I have encountered the same issues and manually, we need to provide proper path to all icons or .gif, .jpg whatever which comes from assets folder in your bundled file in your remote location in production mode.
e.g if you have some path like https://ip_address_name/gi-new, you need to add (/gi-new/assets/your_icon_name) everywhere in production bundled file.
This is one way to solve this particular issue.
Solution 2:[2]
solved myself. only added a entry in environmentprod files for baseHref and added the value before the "assets/svg-icons
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sanu Kumar |
| Solution 2 | Sunil K. |
