ng-inline-svg icon indicating copy to clipboard operation
ng-inline-svg copied to clipboard

How can I set default arguments for all the usages across the app?

Open r0manchak opened this issue 5 years ago • 3 comments

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

r0manchak avatar Mar 04 '19 15:03 r0manchak

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.

arkon avatar Mar 05 '19 12:03 arkon

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

r0manchak avatar Mar 06 '19 09:03 r0manchak

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.

vibonacci avatar Apr 15 '21 15:04 vibonacci