-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Add md-no-asterisk to inputs #3681
Comments
I think currently simplest solution is to change mat-placeholder-required CSS class: |
Hi, @mizdler Yes, you are right. If we do not need asterisk It would be really nice to have the ability to disable asterisk in input without modification of styles. |
I agree that this option should be available, but I think it may be used as a mdInput Something like: Or it'll be better just to be named If you want I can send a PR with this change. |
In material 1 mdNoAsterisk already existed and worked for this purpose. As seen on the documentation here https://material.angularjs.org/latest/api/directive/mdInput |
@prowwid |
@mbeckenbach I think the idea is you specified something and it changed what you expected, maybe they shouldn't have been rendered in the first place. https://material.io/guidelines/components/text-fields.html#text-fields-layout the spec says that "In forms with some required fields, indicate all of the required ones. However, if there are fewer optional fields, indicate those instead" So essentially to get the proper functionality where a form has more optional fields than required fields you have to do something hacky with the styles instead of telling the component to not use the asterisks. It seems to meet the spec, users should be able to turn off the asterisks. @jefersonestevo go for the pr see what happens? ¯\(ツ)/¯ |
Talked with @jelbourn, we're up for adding a |
@mmalerba I might be able to, but @jefersonestevo said they could submit a pr. |
The |
Awesome thanks! |
Hi @mbeckenbach
Because customization of CSS is a hack for this use-case. If you don't need an asterisk - don't even render it. Basically input component does more work than it should and renders redundant content. |
…ntainer This attribute will enable the user to hide the required marker (star) fron an mdInput even when it's required Fixes angular#3681
* fix(input-container): New attribute hideRequiredMarker to md-input-container This attribute will enable the user to hide the required marker (star) fron an mdInput even when it's required Fixes #3681 * fix(input-container): Checking if the input container placeholder has the '*' before applying the 'hideRequiredMarker' attribute on test. Removing extra leading space on hideRequiredMarker demo.
Is this isn't available on md-select component? i have material2 v2.0.0-beta.8 Because i got this error:
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
request
What is the current behavior?
There is no ability to remove asterisks from placeholders in inputs with required attribute.
What is the expected behavior?
We need an ability to disable asterisks on required inputs like in the first version of material UI by using "md-no-asterisk" attribute in input.
In the end, it would be good enough to have syntax like in the following example:
Plunker md-no-asterisk example
What is the use-case or motivation for changing an existing behavior?
For now, there are two hacks to remove asterisks from inputs:
Both options are crutches. And as you know crutches are really bad things.
The text was updated successfully, but these errors were encountered: