How to show md error in material select box in angular 2?
I am using reactive forms for validation in my angular 2 project. I want to highlight fields that are invalid when "submit" is pressed. I achieved this in the input tag using md-Error, but I cannot do it in md-Select. Can anyone please help?
Screenshot: http://i.imgur.com/uOQbwaZ.png
This is the md-select example I'm using:
<md-select placeholder="Listing Type" formControlName='listingType' required >
<md-option *ngFor="let type of listType" [value]="type">
{{ type }}
</md-option>
</md-select>
This is the md input I am using:
<md-input-container class="more-width">
<input mdInput formControlName='price' required placeholder="Price">
<md-error>Please Enter Price</md-error>
</md-input-container>
This is the test I am applying
this.listingForm = this.fb.group({
propertyType: ['', Validators.required]
})
+3
source to share
1 answer
You can show a red line below the box, but no error messages right now. I think it will be very soon. Github issue
0
source to share