Ais-Rating-Menu | Angular InstantSearch V4 (Deprecated)
Signature
<ais-rating-menu attribute="string" // Optional parameters [max]="number" andUpLabel="string" ></ais-rating-menu>
Import
Copy
1
2
3
4
5
6
7
8
import { NgAisRatingMenuModule } from 'angular-instantsearch';
@NgModule({
imports: [
NgAisRatingMenuModule,
],
})
export class AppModule {}
1. Follow additional steps in Optimize build size to ensure your code is correctly bundled.
2. This imports all the widgets, even the ones you don’t use. Read the Getting started guide for more information.
About this widget
The ais-rating-menu
lets users refine search results by clicking on stars.
The stars are based on the selected attribute.
Requirements
- The attributes passed to the
attributes
prop must be declared as Attributes for faceting on the Algolia dashboard) or configured asattributesForFaceting
with the Algolia API.
The attribute values must be integers, not strings nor floats. If your dataset includes float values, the widget returns only exact numerical matches. For example, if a user selects “4 [stars] & Up”, we only return records with values such as 4
or 5
, not records with values like 4.5
or 4.7
. If your attribute is a float, we recommend indexing a new attribute with the rounded integer value to use in this widget.
Examples
1
<ais-rating-menu attribute="rating"></ais-rating-menu>
Props
attribute
string
The name of the attribute in the record.
1
<ais-rating-menu attribute="rating"></ais-rating-menu>
max
number
The maximum value for the rating.
1
2
3
4
<ais-rating-menu
// ...
[max]="3"
></ais-rating-menu>
andUpLabel
string
Label for the “& Up” message.
1
2
3
4
<ais-rating-menu
// ...
andUpLabel="& More"
></ais-rating-menu>