I am trying to add ngControl form validation to bootstrap 4 typehead control in Angualr js 2. code is as follows.
<input [(ngModel)]="model.brand" [typeahead]="model.brands" ng-model-options="{'updateOn': 'blur'}"
(typeaheadOnSelect)="brandOnSelect($event)" (typeaheadNoResults)="brandNoResults($event)"
[typeaheadOptionField]="'Value'" class="form-control" ngcontrol="brand" >
<div *ngIf="brand.dirty && !brand.valid ">
<p *ngIf="brand.errors.required" class="text-help">{{ required }}</p>
</div>
You have missed "name" attribute on input which is required to work ngModel properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With