NgbTypeahead required validation with reactive form works incorrectly
See original GitHub issueBug description:
In markup I have this code
<div class="first-group-margin form-group">
<label for="recipient">{{ 'To' | translate }}:</label>
<input id="recipient" type="text" class="tatoo-form-control" name="recipient" [ngbTypeahead]="search"
[resultFormatter]="autocompleteFormatter" [inputFormatter]="autocompleteFormatter" [class.is-invalid]="recipient.invalid && recipient.touched"
formControlName="recipient" [editable]="false" placeholder="{{ 'Placeholder.UserRecipient' | translate }}"
autocomplete="false" (selectItem)="changeEvent($event)">
<div class="alert-absolute alert alert-danger mt-2" *ngIf="recipient.touched && recipient.invalid">
<span *ngIf="recipient.errors['required']">{{'Validation.BlankRecipient' | translate}}</span>
</div>
</div>
and when I select value from dropdown the input field is ‘blinking red’ because change event occures earlier then typeahead select item event I think. So my form control become invalid for a while
Version of Angular, ng-bootstrap, and Bootstrap:
Angular: 6.0.2
ng-bootstrap: 2.0.0
Bootstrap: 4.1.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
ng bootstrap typeahead not working with angular reactive form
the problem is that when search function is declared, "instance is undefined". This happens e.g. if we has some like <div *ngIf="form" ...
Read more >NgbTypeahead required validation with reactive form works ...
Bug description: In markup I have this code <div class="first-group-margin form-group"> <label for="recipient">{{ 'To' | translate }}: ...
Read more >Ng Bootstrap Typeahead Not Working With Angular Reactive ...
NgbTypeahead required validation with reactive form works incorrectly #2719 <div classfirstgroupmargin formgroup> <label.
Read more >Typeahead - Angular powered Bootstrap
A directive providing a simple way of creating powerful typeaheads from any text input. Selector: 'input[ngbTypeahead]'. Exported as: 'ngbTypeahead'. Inputs ...
Read more >Angular Custom Form Controls with Reactive Forms and ...
We can see our custom app-switch works seamlessly with the Reactive Forms/Form Builder API just like any other text input.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OMG - I’ve been looking for this functionality for weeks - hopefully I can get this to work with ngbTypeahead in Angular 7.0.2 !?
here plunkr working demo http://plnkr.co/edit/42AB4yXBsiuGDuFCC0C5