John H John H - 20 days ago 8
AngularJS Question

md-is-error not working on md-input-container with md-select

I use md-is-error to show error. It works fine in input but not working in md-select. This is my code:

<div ng-controller="AppCtrl" layout="column" ng-cloak="" class="inputdemoErrors" ng-app="MyApp">

<md-content layout-padding="">
<form ng-submit="projectForm()" name="testForm">

<div layout="row">
<md-input-container class="md-block" flex-gt-sm md-is-error="project.postalCode == undefined && testForm.$submited">
<label>Postal Code</label>
<input ng-model="project.postalCode"
required name="ptCodeInput">
</md-input-container>
<md-input-container flex="50" md-is-error="project.type == undefined && testForm.$submited">
<label>Project Type</label>
<md-select ng-model="project.type" required>
<md-option value="app">Application</md-option>
<md-option value="web">Website</md-option>
</md-select>
</md-input-container>
</div>
<div>
<md-button type="submit">Submit</md-button>
</div>
</form>
</md-content>
</div>


My code works fine with
Postal Code
, but
Project Type
selection it not working.

Have any suggestion for use md-is-error in md-select?

Answer

There is already an issue raised for the same

md-select is missing md-input-invalid

It shows the error message when there is a change such as ng-blur.

Hope it helps.

Comments