I'm using the following code add icons to the MdIconRegistry:
constructor(iconRegistry: MdIconRegistry, sanitizer: DomSanitizer) {
iconRegistry.addSvgIconSet(
sanitizer.bypassSecurityTrustResourceUrl('/assets/svg-sprite-action-symbol.svg'));
iconRegistry.addSvgIconSet(
sanitizer.bypassSecurityTrustResourceUrl('/assets/svg-sprite-content-symbol.svg'));
iconRegistry.addSvgIconSet(
sanitizer.bypassSecurityTrustResourceUrl('/assets/svg-sprite-navigation-symbol.svg'));
}
This unfortunately breaks when using ng [build|serve] --deploy-url=/public/ (In production I would like to deploy the ng build output to a CDN)
Is there a way that I can access the webpack publicPath variable from my angular component so that I can specify the urls for the svg icons relative to that?
I had a look in the ng build output, and I can see the variable is set in inline.bundle.js, but I'm not sure how to correctly access it.
/******/ __webpack_require__.p = "/public/";