Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No provider for NgModel! (Typeahead -> NgModel) exception when adding ngControl to bootstrap 4 TypeHead angular 2

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>
like image 464
sachin kulkarni Avatar asked Apr 19 '16 16:04

sachin kulkarni


1 Answers

You have missed "name" attribute on input which is required to work ngModel properly.

like image 55
be4code Avatar answered Oct 04 '22 02:10

be4code