ais-hits
<ais-hits // Optional parameters [transformItems]="function" ></ais-hits>
About this widget
Use ais-hits
to display a list of results. To configure the number of hits to show, use one of:
- The
ais-hits-per-page
widget - The
ais-configure
widget and setting thehitsPerPage
insearchParameters
.
For guidance on how to search across more than one index, read the multi-index search guide.
Examples
1
<ais-hits></ais-hits>
Properties
transformItems
|
type: function
default: items => items
Optional
Receives the items and is called before displaying them. Should return a new array with the same shape as the original array. Useful for transforming, removing, or reordering items. In addition, the full If you’re transforming an attribute using the |
||
Copy
|
Templates
hits
|
type: object[]
The matched hits from the Algolia API. You can leverage the highlighting feature of Algolia with the |
||
results
|
type: object
The complete response from the Algolia API. It contains the |
||
Copy
|
|||
insights
|
type: function
signature: (method: string, payload: object) => void
Sends insights events.
|
||
Copy
|
HTML output
1
2
3
4
5
6
7
8
9
10
11
12
13
<div class="ais-Hits">
<ul class="ais-Hits-list">
<li class="ais-Hits-item">
...
</li>
<li class="ais-Hits-item">
...
</li>
<li class="ais-Hits-item">
...
</li>
</ul>
</div>
Sending Click and Conversion events
Please refer to the guide on Sending Insight Events to learn about sending events from any InstantSearch widget.