Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

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

Open
r0manchak opened this issue Mar 4, 2019 · 3 comments
Open

Comments

@r0manchak
Copy link

r0manchak commented Mar 4, 2019

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

@arkon
Copy link
Owner

arkon commented Mar 5, 2019

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.

@r0manchak
Copy link
Author

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

@vibonacci
Copy link

vibonacci commented Apr 15, 2021

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants