Angular 6 form validation simple example. With email validation and select box(drop down).ngForm simple example in angular 6 with select box
Use ngForm. Import it your component.module.ts(module file)
import { FormsModule } from '@angular/forms';
Add it your component template
Add it your component.ts
allnames = [{
name_id: 1,
name: 'Jhon'
}, {
name_id: 2,
name: 'Chena'
}, {
name_id: 3,
name: 'Jack'
}]
model: any = {};
ngOnInit() {
this.model.name_id = 2;
}
The name Chena is selected in select box and email valid. It's work well. And i will use it.