iconify-angular icon indicating copy to clipboard operation
iconify-angular copied to clipboard

coerce input properties

Open mokipedia opened this issue 4 years ago • 4 comments

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[X] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

Inputs need to be set as [inline]="true" so boolean properties, numbers and sizes are correctly handled.

Expected behavior

properties should be able to coerce from string attributes

What is the motivation / use case for changing the behavior?

more infos why you should allow / check for this can be found for example here: https://netbasal.com/trust-but-verify-coerce-your-component-inputs-bdb743e8b579

Environment

Angular ships with a coercion package in Angular CDK 5+, so it should be fine for all allowed Angular versions.


Angular version: 5+
https://github.com/angular/components/tree/5.0.x/src/cdk/coercion

If wanted, I can submit a PR

mokipedia avatar Jan 27 '21 11:01 mokipedia

It would also be more aligned with React, as React supports this by default: https://github.com/iconify/iconify/tree/master/packages/react

mokipedia avatar Feb 04 '21 10:02 mokipedia

@mokipedia Sure, this sounds like a great addition. Feel free to submit a PR, otherwise I'll take a look at it whenever I get the time. 👍

visurel avatar Feb 04 '21 12:02 visurel

In new version of React component I've moved all common code to reusable package @iconify/core, which is used by React, Vue and Svelte components. New version is rewritten in TypeScript, which makes it easier to export types. See "packages/core" directory.

That should make it easy to update Angular component too. I'd be happy to help if you have any questions, but I'm not familiar with Angular specific stuff.

cyberalien avatar Feb 04 '21 12:02 cyberalien

@cyberalien I see what you did there. there is a lot to be shared here. It would also mean quite a bit of refactoring instead of an easy small change like my initial request. I am in favour of refactoring, but currently lack the time to do so without the security of having automated tests.

mokipedia avatar Feb 04 '21 12:02 mokipedia