Maks K
Maks K

Reputation: 3914

How to validate md-select in angular material 2?

everyone.

I am developing app with angular and I am using Angular material for UI.

I know about angular validation

https://angular.io/docs/ts/latest/cookbook/form-validation.html

How can I validate md-select ?

Upvotes: 0

Views: 1841

Answers (1)

Nehal
Nehal

Reputation: 13317

You can validate md-select the same way it's shown in the documentation. The main idea is to create a reference #someName and the use that reference to do the validation. There are six controls that Angular provides: touched, untouched, dirty, pristine, valid and invalid.

I created a Plunker demo for you with the dirty validation for md-select.

You can read more about validation in the "Track control state and validity with ngModel" section, here: https://angular.io/docs/ts/latest/guide/forms.html

Upvotes: 2

Related Questions