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

Help message class #10

Open
kingcody opened this issue Nov 22, 2017 · 2 comments
Open

Help message class #10

kingcody opened this issue Nov 22, 2017 · 2 comments

Comments

@kingcody
Copy link
Collaborator

Hi there,

First off, I'd like to say; nice module, thanks for sharing it!

I'm actually using this for a Bootstrap 4 based project and for the most part it works great. However in bootstrap 4(alpha,beta) the help block's classes have changed. I was wondering if you had any thoughts on a nice clean way that could be customized. Obviously another parameter to the forRoot method would work, but that seems a bit excessive.

For now, I'm using Bootstrap 4 alpha, so I've patched the help block class:

.help-block { @extend .form-control-feedback; }

Which works perfectly and is fairly unintrusive.

Anyways, I just figured it might be a topic worth discussing, thanks again.

@third774
Copy link
Owner

Thanks for mentioning this!

Can you expand on what you mean by excessive? Configuring the module in one place with a class that should be used everywhere seems reasonable, but I could definitely see situations where people may want to individually customize the classes in a specific place.

Right now there isn't a component that is used to display error messages, but I'm thinking about introducing one to solve the issue (#6) with horizontal forms. (Quick aside on that - the conditions that the messages are displayed would still be managed internally within the new component) This new error message component could potentially accept a class input to over-ride the top level configuration.

@kingcody
Copy link
Collaborator Author

Hey there, sorry for taking so long to get back to this.

On the thought of how validation messages are configured now; what do you think about using a multi-provider as the means of configuration. It would be inline with how custom validators and interceptors are configured. You could swap your array order for the messages array like this:

  get errorMessages(): ErrorMessage[] {
    return [
      ...this.errorMessageService.errorMessages,
      ...this.customErrorMessages
    ];
}

and then just use something like lastIndexOf

Related to #6, I think that a separate component would definitely be in order. I think the placement logic in the form-group-component is real fun part. lol

Back to the original question, after thinking about it for a bit (ok, about a month lol), configuring the style class in the forRoot static method would work for how this module is used. Most components are configured at a template or controller level so I think it just initially threw me off; but seeing as how this module acts fairly transparently at the component level it makes sense to configure it at a module level.

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