bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

typeahead-loading stuck on true when editable = false and focus is lost while loading

Open fbarbat opened this issue 9 years ago • 5 comments

Bug description:

If typeahead is editable=false and focus is lost during loading, typeahead-loading get stuck on "true".

Link to minimally-working plunker that reproduces the issue:

https://plnkr.co/edit/pmEfFVWkekOeqYHgYhFZ?p=preview

Version of Angular, UIBS, and Bootstrap

Angular: 1.5.8 UIBS: 2.2.0 Bootstrap: 3.3.7

fbarbat avatar Oct 10 '16 18:10 fbarbat

+1

MatejQ avatar Feb 21 '17 12:02 MatejQ

Any update on this bug? It's still occurringin 1.1.2

will-tr avatar Apr 15 '17 00:04 will-tr

+1

seanzi86 avatar Sep 12 '17 15:09 seanzi86

+1 as I am able to reproduce this quite often and seems to be very annoying to our clients

andreikun avatar Apr 11 '18 12:04 andreikun

As workaround, I tried to set the loading variable to false once I've got the data from server. In the same time, I used a cancel request logic onBlur and e.target.value is empty string. It works.

`searchCompanies(value) { const ctrl = this;

	this.companySearchCanceller.resolve();
	this.companySearchCanceller = this.$q.defer();

	return this.ApiService.searchCompanies(
		{
			country: ctrl.search.country,
			term: value
		},
		ctrl.companySearchCanceller.promise
	).then((response) => {
		this.loadingCompanies = false;
		return response.data.data;
	}, (error) => {
		//Handle aborted requests to avoid no results popup
		if (error.status === -1) {
			ctrl.noCompanies = false;
		}

		this.loadingCompanies = false;
	});
}

onBlur($e) {
	if ($e.target.value.length === 0) {
		this.companySearchCanceller.resolve();
		this.loadingCompanies = false;
	}

}`

andreikun avatar Apr 11 '18 13:04 andreikun