When using a select option, it should be set up like:
<div class="form-group row" [ngClass]="{'has-error': (!form.controls['blockFirstIndex'].valid && form.controls['blockFirstIndex'].touched), 'has-success': (form.controls['blockFirstIndex'].valid && form.controls['blockFirstIndex'].touched)}">
<label class="col-sm-3 control-label">blockFirstIndex</label>
<div class="col-sm-9">
<select formControlName="blockFirstIndex" [(ngModel)]="value" class="form-control">
<option *ngFor="let item of items" [disabled]="item.id==0" [ngValue]="item">{{item.name}}</option>
</select>
</div>
</div>
To set up a validator, use the following code:
this.form = this.fb.group({
'blockFirstIndex': ['', Validators.compose([Validators.required])],
});
If you want the validator to not accept the select option with index 0, how should I go about doing that?