Skip to content
This repository has been archived by the owner on Jan 22, 2018. It is now read-only.

Issues with label wrapper styles. #20

Open
juanpujol opened this issue Jan 20, 2016 · 3 comments
Open

Issues with label wrapper styles. #20

juanpujol opened this issue Jan 20, 2016 · 3 comments
Milestone

Comments

@juanpujol
Copy link

I've a custom field using ui.bootstrap datepicker. The option.type is "datepicker" so it doesn't work with this line here:

module.exports = "<label for=\"{{id}}\" ng-style=\"['input', 'textarea', 'select'].indexOf(options.type) === -1 && {'font-size':'12px', 'color': 'rgb(117, 117, 117)'}\">\n {{to.label}}\n</label>\n<formly-transclude></formly-transclude>\n";

screenshot 2016-01-20 09 21 18

I had to manually add my field to the array on ng-style so the label will work as expected.

module.exports = "<label for=\"{{id}}\" ng-style=\"['input', 'textarea', 'select', 'datepicker'].indexOf(options.type) === -1 && {'font-size':'12px', 'color': 'rgb(117, 117, 117)'}\">\n {{to.label}}\n</label>\n<formly-transclude></formly-transclude>\n";

screenshot 2016-01-20 09 20 18

Is there any other way to deal with this? I understand it's nessesary because of checkboxes or radios. But it ends up limiting my avility to extend and create more fields.

Thank you.

@kamilkisiela
Copy link
Collaborator

The easiest way of doing this and much more simpler would be creating two separate wrappers.

So original types like input, textarea, select and datepicker will have let's call it labelSrc
and other fields label.

So label will have ng-style (in that case just style attribute) but labelSrc won't.

What do you think? Is it simply enough and won't be misleading?

@juanpujol
Copy link
Author

I think that could solve the problem. But also it will be confusing having 2 diferent label wrappers.

Are you thinking on doing this for this for this library or is a recommendation for this specific case?

Thanks.

@kamilkisiela
Copy link
Collaborator

It is much more simpler with templates like lumx and bootstrap. Label wrapper is independent from whichever type you use. It has own class and style, correct in any case.

In material templates it is much more complicated because mdInputContainer contains label.

I think it could be done with css class with proper selectors but I'm trying to avoid css files in that package.

I'm going to think about it and to try few things.

Maybe you have an idea to do it nicely?

About your question. It is good when wrapper can be used with all types. That's the reason of that ng-style thing :)

@kamilkisiela kamilkisiela added this to the v1.0.0 milestone Mar 2, 2016
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

2 participants