Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngbTypeahead inside modal window problem #5366

Open
MaximumRGB opened this issue Aug 23, 2019 · 2 comments
Open

ngbTypeahead inside modal window problem #5366

MaximumRGB opened this issue Aug 23, 2019 · 2 comments

Comments

@MaximumRGB
Copy link

MaximumRGB commented Aug 23, 2019

Hello everyone.
I have a problem using ngbTypeahead in modal window, shown by BsModalService. On every typing inside ngbTypeahead <input> element my app sends http-request. The problem is that if i make a mouse click in modal window area ("modal-content") at the moment when request is sent, but answer is not got yet, then request canceles.

template <input> element:
<input type="text" class="form-control" formControlName="layer" #ownerSauid ="ngbTypeahead" [(ngModel)]="ngValue" [ngbTypeahead]="search" [resultFormatter]="formatResult" [inputFormatter]="formatMatches" (selectItem)="getDivisions($event)" (input)="clearDivisions()" required />

ngbTypeahead search:
search = (text$: Observable<string>) => text$.pipe( debounceTime(300), distinctUntilChanged(), tap(term => this.loading = !!term.length), switchMap(term => term.length > 0 ? this.layersService.getLayerByID(term).pipe( tap(data => this.searchFailed = false), catchError((error) => { this.searchFailed = true; this.loading = false; return observableOf([]); }) ) : []), tap(() => this.loading = false));

@ludmilanesvitiy
Copy link
Contributor

@MaximumRGB Hi! If it's possible - create a reproduction via Stackblitz. Thanks

@apotapcukv
Copy link
Contributor

Hi, @MaximumRGB! We can’t reproduce the issue now in the latest version to check if it has been fixed or not. If you still can, please do it at https://stackblitz.com/edit/angular-ivy-de1elj?file=tsconfig.json/ and share with us, or please add a recorded video, or just send us steps to reproduce. Thank you for using our library).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants