ng-inline-svg
ng-inline-svg copied to clipboard
How can I set default arguments for all the usages across the app?
Hi, First of all, thanks for such a nice and useful library.
I'm using an HTML like this:
<span [inlineSVG]="'assets/iconsSet/Tick in circle.svg'" [removeSVGAttributes]="['width', 'height', 'fill']"></span>
Is it possible to set some default arguments (e.g. removeSVGAttributes
) to be used across the whole app every time the [inlineSVG]
directive is used?
The way the baseUrl
is configured would be great for me to configure arguments as well.
Many thanks, Andrii
Good idea! Do you know of any other directives/components that have a similar feature to what you're looking for? I'm curious as to how something like that is typically done.
Good idea! Do you know of any other directives/components that have a similar feature to what you're looking for? I'm curious as to how something like that is typically done.
Sorry, I can't remember something similar now, furthermore I'm not sure I've ever used such packages
This feature is almost a must. You should be able to set default values for each option given as directives, but still have the option to override it for a specific inlineSvg.
Inside inline-svg.directive.ts
, the function _insertEl
, you can check which directives are given. If some are not given, check if a default is defined in inline-svg.config.ts
. If so, use it, otherwise not.
inline-svg.config
needs to be expanded with all directive options.