Improve example Documentation for Typeahead to make sense
See original GitHub issueI’m creating a typeahead that remotely calls an api every time someone types in the input, with a small delay after typing.
This code is from the bootstrap 4 typeahead example docs (Wikipedia example) makes no sense to me with all the .call
and _do
functions.
Angular Component
search = (text$: Observable<string>) =>
_do.call(
switchMap.call(
_do.call(distinctUntilChanged.call(
debounceTime.call(text$, 300)),
() => this.searching = true),
(term) => _catch.call(
_do.call(this._service.search(term),
() => this.searchFailed = false),
() => {
this.searchFailed = true;
return of.call([]);
})),
() => this.searching = false);
HTML
<md-input-container>
<input mdInput [ngbTypeahead]="search"
[(ngModel)]="model"
[formControl]="lookupSubscriberControl"
type="text"
placeholder="Search by Name">
<button type="submit" mdSuffix class="material-icons">search</button>
</md-input-container>
-
What does this do in English? Right now I do not understand how to read this in normal terms and therefore cannot rewrite it for my needs.
-
Can someone help me rewrite this in a more readable format? Such as using the chained sequence of promises, or anything else that makes more sense.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
12 Autocomplete Suggestion Design Best Practices
Poor autocomplete design can prevent customers from making purchases. These 12 best practices will create a smooth user experience and ...
Read more >jQuery Typeahead Search Configuration - RunningCoder
Configure jQuery Typeahead Search plugin, learn about the options and what they can do to improve your search bar.
Read more >Develop with Couchbase Full-Text Search & Node.js
Learn to create a UI typeahead that populates based on data from Couchbase Full-Text Search (FTS) service using Node.js, jQuery, ...
Read more >Twitter Bootstrap typeaheads tutorial - w3resource
Introduction. In this tutorial, you will see how to create typeaheads using Twitter Bootstrap. typeaheads are very useful to supply hints or ...
Read more >Cutting Edge - Type Ahead | Microsoft Learn
For this article, I'll clarify the basics of using typeahead in a realistic scenario using the version of typeahead you find on NuGet...
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
I agree that in the current form the example is very hard to read… I’m going to revert the change that introduced
.call(...)
as we care about this library working with the closure compiler. We don’t build demo with closure so we don’t need to keep it closure-compatible. On top of this.call
are needed only because of an issue in the closure compiler itself…@pkozlowski-opensource Awesome, thanks for doing that.