-
Notifications
You must be signed in to change notification settings - Fork 556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Escape hatch #2077
Comments
Do you really need formly for this? We are using the |
That's on our radar, it's just a matter of time. The implementation doesn't require a lot of work and some part of it already possible with the current
{
key: 'name',
type: InputFieldType,
} Note: if you need this feature asap, let me know to provide you a working example, also I may accept a PR.
Note: it can be achieved using a custom field type that relies on CDK Portal.
{ template: `<div>Hello Formly!</div>` } |
check my proposal #2086 (comment) |
sorry for the very slow answer, we had a huge deadline.. ad 1.) I like this very much! This would be definitely helpful for form specific renderings. I could try to make a PR, but I still need to get to know the library better :) ad 2.) We actually did already something like this. We created a simple field type, where a template ref is accepted, so this is for sure helpful. |
@aitboudad i love the proposal in #2086. Has this already been implemented on master? |
PS: In the absence of ^, it would be totally amazing to get a working example! Very kind offer. |
@viztastic not yet, PR welcomed! |
This issue has been fixed and released as part of v6.0.0-beta.0 release. Please let us know, in case you are still encountering a similar issue/problem. |
It would be great to have a possibility to "break out" of formly at some point in the structure. No matter how hard you try to harmonize forms, there will always be a situation, where you need to implement something very specific to this one form.
For example:
e.g. have a password strength indicator next to your input field
e.g. an icon with an explanation what this section is for in specific
e.g. the shipping address as it will be printed on the package
Our Current Solutions
We defined various "output" fields as a solution for some of the above situations. E.g. one will display a static text or static html. This worked for some time until we needed to use an angular component. Then we crafted a field, which accepts a template reference. With this we managed to make some static renderings with angular components.
So we found various, creative solutions to implement what we need, but it felt like we were fighting against the framework.
Solutions
As the described problems are diverse, one could find some unique solution for each. But I think some general, well designed "escape hatch" could fit all problems.
By the way, most likely you could define a new field or wrapper as a solution for the problems described. But I am strongly against this approach, as you would "pollute" the global config with fields, which are needed at exactly one place.
Idea 1: Component type
Be able to configure a component, which will be rendered instead of a predefined field. The component will get the current form and model either by a service or input parameter. With this you could have the freedom to define unique forms or what ever rendering you might need.
Probably it would be nice to also directly define a component also as a wrapper.
Idea 2: register per instance fields/wrappers
A maybe easier approach (but not as elegant as the above) would be to define fields/wrappers on an instance base. In this way you wouldn't pollute the global config.
Summary
I would be interested, if others are facing similar issues. If this is something you would consider for the library, I am willing to participate in the implementation.
cheers, and thanks for this library!
PS: This is the first time we are using formly on a project but, so far this is conceptually exactly what I was looking for quite some time!
The text was updated successfully, but these errors were encountered: