MdInput doesn't set required asterisk when the validator is set in reactive forms
See original GitHub issueBug, feature request, or proposal:
The placeholder
from the MdInput does not show the asterisk (*) when we use Validators.required
in the FormControl
.
What is the expected behavior?
The asterisk should be shown as it is when setting the required
attribute.
What are the steps to reproduce?
http://plnkr.co/edit/XqkOmF502Q8RFj8qcUwp?p=preview or take a look at the input-container-demo
What is the use-case or motivation for changing an existing behavior?
To be not dependet on the template to visually indicate that the input is required.
Which versions of Angular, Material, OS, browsers are affected?
all (to my knowlege it never worked)
Issue Analytics
- State:
- Created 7 years ago
- Reactions:115
- Comments:59 (10 by maintainers)
Top Results From Across the Web
How to add 'required field' asterisk to angular reactive form ...
My solution by generate new Directive: ng generate directive directive/mark-asterisk. This is full code of directive:
Read more >Is This Possible With Reactive Forms? : r/angular - Reddit
Is there an easy way to do this with reactive forms? ... MdInput doesn't set required asterisk when the validator is set in...
Read more >Material Input Auto Required Asterisk - StackBlitz
Form field with error messages. ... import {FormsModule, ReactiveFormsModule}. from '@angular/forms'; ... app/mat-input-required.directive';.
Read more >3 ways to implement conditional validation of Angular reactive ...
After we're all set, let's try to implement conditional validation. If checkbox value is true , we will set the required validator to...
Read more >Angular Reactive Forms: trigger validation on submit
Displaying the required field asterisk (*); Validating all fields on ... In this form we have name , email and a set of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m using this solution:
<input formControlName="name" [required]="formGroup.get('name').errors !== null && formGroup.get('name').errors.required">
Any ETA ??