ais-infinite-hits
<ais-infinite-hits // Optional parameters showPrevious="boolean" showPreviousLabel="string" showMoreLabel="string" [transformItems]="function" ></ais-infinite-hits>
About this widget
The ais-infinite-hits
is used to display a list of results. To configure the number of hits to show, use either:
- the
ais-hits-per-page
widget, - or the
ais-configure
widget and setting thehitsPerPage
insearchParameters
.
Examples
1
<ais-infinite-hits></ais-infinite-hits>
Properties
showPrevious
|
type: boolean
default: false
Optional
Enable the button to load previous results. The button is only displayed if the routing option is enabled in |
||
showPreviousLabel
|
type: string
default: "Show previous results"
Optional
Label used on the “Show previous” button. |
||
showMoreLabel
|
type: string
default: "Show more results"
Optional
Label used on the “Show more” button. |
||
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 |
||
isFirstPage
|
type: boolean
Indicates whether the first page of hits has been reached. |
||
isLastPage
|
type: boolean
Indicates whether the last page of hits has been reached. |
||
showPrevious
|
type: function
Loads the previous page of hits. |
||
Copy
|
|||
showMore
|
type: function
Loads the next page of hits. |
||
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
14
15
16
17
<div class="ais-InfiniteHits">
<button class="ais-InfiniteHits-showPrevious">Show previous results</button>
<ul class="ais-InfiniteHits-list">
<li class="ais-InfiniteHits-item">
...
</li>
<li class="ais-InfiniteHits-item">
...
</li>
<li class="ais-InfiniteHits-item">
...
</li>
</ul>
<button class="ais-InfiniteHits-showMore">Show more results</button>
</div>
Sending Click and Conversion events
Please refer to the guide on Sending Insight Events to learn about sending events from any InstantSearch widget.