Skip to content
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

Generic input-container #4672

Closed
mbeckenbach opened this issue May 19, 2017 · 7 comments
Closed

Generic input-container #4672

mbeckenbach opened this issue May 19, 2017 · 7 comments
Assignees
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@mbeckenbach
Copy link

Bug, feature request, or proposal:

feature request

What is the expected behavior?

There should be something similar to the md-input-container which does not depend on a input control inside, so that the benefits for styling error states, using md-error and md-hint can easily be used for custom form controls.

What is the current behavior?

md-input-container has a very limited support for form-controls.

What are the steps to reproduce?

Read the docs :-)

What is the use-case or motivation for changing an existing behavior?

When using md-input-container it's really easy to have those nice animated md-error hints and invalid highlight. It's not that easy to get angular to adding the ng-invalid, ng-dirty and so on classes to a parent element like the md-input-container. So creating a similar look and feel for custom controls can be hard.

It would be very cool to use md-input-container for anything.

<md-input-container>
    <my-cool-control mdInput></my-cool-control>
   <md-error>User did something wrong</md-error>
</md-input-container>

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

ng 4.1.x, md beta 5

Is there anything else we should know?

@jelbourn
Copy link
Member

@mmalerba I know we planned to support this when designing the input container- what's the status on this?

@jelbourn jelbourn added the feature This issue represents a new feature or feature request rather than a bug or bug fix label May 23, 2017
@mmalerba
Copy link
Contributor

Haven't gotten time to work on it yet, but its a feature I'd love to add

@jelbourn jelbourn added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label May 23, 2017
@natsid
Copy link

natsid commented Jun 1, 2017

Is the idea for md-input-container to be able to contain all (or most?) of the other Material form controls so that they can all utilize md-hint and md-error, etc.?

@jelbourn
Copy link
Member

jelbourn commented Jun 1, 2017

This issue is tracking the ability to do something like

<md-input-container>
  <my-custom-input mdInput></my-custom-input>
</md-input-container>

(as opposed to always having to be an <input> element)

There's a separate issue of having md-select and md-input-container share the same setup

@natsid
Copy link

natsid commented Jun 1, 2017

Ah, I missed the mdInput on the custom tag - thought it was just any custom component. Thanks.

@mmalerba
Copy link
Contributor

This is now available, see the guide: https://material.angular.io/guide/creating-a-custom-form-field-control

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

4 participants