question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to show results only when user types in the search box?

See original GitHub issue

below is my html and typescript code

<ais-instantsearch [config]="comment">
  <ais-search-box></ais-search-box>
  <ais-hits>
    <ng-template let-hits="hits">
      <div class="row">
        <div *ngFor="let hit of hits" class="col-4">
          <div class="comments">
            <ais-highlight attribute="name" [hit]="hit"> </ais-highlight>
            <h6>{{hit.email}} </h6>
            <p> {{hit.body}}</p>
          </div>
        </div>
      </div>
    </ng-template>
  </ais-hits>
</ais-instantsearch>
comment={
    apiKey: 'apikey',
    appId: 'apiid',
    indexName: 'comment',
  }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
francoischalifourcommented, Jan 14, 2019

The ais-hits widget provides the results value containing the current query. You can conditionally show the results based on results.query.

<ais-hits>
  <ng-template let-hits="hits" let-results="results">
    <div *ngIf="results.query">
      <!-- only show results if the query is not empty -->
    </div>
  </ng-template>
</ais-hits>
0reactions
dmsammusiccommented, Sep 13, 2022

Hi could u update the code to latest Angular 14v and Anguar-Instantsearch to v4, because i am using the same code throws error. the no result content always shows.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make only 5 results to be visible in a search bar at a time
I want to make it to show ony 5 result and there should be a slidebar at right side from which on sliding...
Read more >
showing a list of results showed while user is writing ...
I'm trying to create a search box where the user write something, and while he do that a listbox with all the matching...
Read more >
<input type="search"> - HTML: HyperText Markup Language
The results attribute—supported only by Safari—is a numeric value that lets you override the maximum number of entries to be displayed in the...
Read more >
How to Filter Search Results While Typing With React
You can use React to build a search bar that filters and displays data as the user types. With React hooks and the...
Read more >
Best Practices for Search | UX Booth
Don't erase users' query after they hit the Search button · Select a proper layout for your data · Display the number of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found