arkon / ng-inline-svg

[Inactive] Angular directive for inserting an SVG file inline within an element.
https://echeung.me/ng-inline-svg/
MIT License
210 stars 88 forks source link

Configure baseUrl after compilation (outside of module.forRoot()) #36

Closed RodyKirwan1 closed 7 years ago

RodyKirwan1 commented 7 years ago

Hi, I'm having issues resolving a dynamic baseUrl within the forRoot() function during AOT. I need to add a locale suffix to the baseHref depending on the environment. Currently I get this value from the DOM but this is not available for AOT compilation - is there a way to globally configure baseUrl after compilation?

arkon commented 7 years ago

You can do something like this now (v3.3.0) :

import { SVGCacheService } from 'ng-inline-svg';

class Whatever {
  constructor(service: SVGCacheService) {
    service.setBaseUrl({ baseUrl: 'https://google.ca/' });
  }
}
RodyKirwan1 commented 7 years ago

Thanks @arkon. Will try it out :)