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

chore(typeahead): with http promise problems #118

Closed
fkowal opened this issue Feb 1, 2016 · 3 comments
Closed

chore(typeahead): with http promise problems #118

fkowal opened this issue Feb 1, 2016 · 3 comments

Comments

@fkowal
Copy link
Contributor

fkowal commented Feb 1, 2016

hi i've got some weird behaviours when working with typeahead "ng2-bootstrap": "1.0.2-beta.0"

<input [(ngModel)]="parameterInput"
           [typeahead]="getParameters(getContext())"
           [typeaheadMinLength]="3"
           [typeaheadWaitMs]="300">
...
getParameters(context) {
        if (this._prevContext === context) {
            return this._cache;
        }
        this._prevContext = context;

       // this.parameterService.getParametersByName(): Observable<any>
        this._cache = () => this.parameterService.getParametersByName(this.parameterInput).toPromise();
        return this._cache;
    }
getContext() { return this; }
  1. minlength is not respected at all
  2. when i start to type 3 chars when the result of http is really long, so it takes longer to fetch
    when i get to 5 chars the results show, and the the result from the first promise (3 chars) kicks in and displays :(
    it also happens that when i type something in and tabout, when the fetching of data takes a longer, the list with typeahead hints pops up when i am already editing another field.
    The hint list doesn't go away unless i go back to typeahead and esc or do something else. :(

The UX is really bad when i compare with the http://angular-ui.github.io/bootstrap/#/typeahead i used before. None of these things happened before.

@valorkin
Copy link
Member

valorkin commented Feb 1, 2016

Check this PR
#99
UX should be rx.Subject based

@fkowal
Copy link
Contributor Author

fkowal commented Feb 3, 2016

yes the PR look promising

http://blog.thoughtram.io/angular/2016/01/06/taking-advantage-of-observables-in-angular2.html
this works verynice

@valorkin valorkin changed the title typeahead with http promise problems chore(typeahead): with http promise problems Feb 3, 2016
@Dinistro
Copy link
Contributor

Fixed in #584

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