Ais-Range-Slider | Angular InstantSearch V4 (Deprecated)
Signature
Import
Copy
1
2
3
4
5
6
7
8
import { NgAisRangeSliderModule } from 'angular-instantsearch';
@NgModule({
imports: [
NgAisRangeSliderModule,
],
})
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-range-slider
allows a user to select a numeric range using a third party slider (noUiSlider in that case).
Requirements
The attribute provided to the widget must be present in “attributes for faceting” on the Algolia dashboard or configured as attributesForFaceting
via setSettings
. The values inside the attribute must be numbers, not strings.
You need to import the external CSS by yourself to make the range slider work. The CSS file is available at:
https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/10.1.0/nouislider.min.css
(CDN)node_modules/nouislider/distribute/nouislider.min.css
(local)
Examples
1
<ais-range-slider attribute="price"></ais-range-slider>
Props
attribute
string
The name of the attribute in the record.
1
<ais-range-slider attribute="price"></ais-range-slider>
min
number
The minimum value for the range. When not provided, the minimum value is automatically computed by Algolia from the data in the index.
1
2
3
4
<ais-range-slider
// ...
[min]="10"
></ais-range-slider>
max
number
The maximum value for the range. When not provided, the maximum value is automatically computed by Algolia from the data in the index.
1
2
3
4
<ais-range-slider
// ...
[max]="500"
></ais-range-slider>
precision
number
The number of digits after the decimal point to use.
1
2
3
4
<ais-range-slider
// ...
[precision]="0"
></ais-range-slider>
pips
boolean
Show slider pips or not.
1
2
3
4
<ais-range-slider
// ...
[pips]="false"
></ais-range-slider>
tooltips
boolean
Show slider tooltips or not.
1
2
3
4
<ais-range-slider
// ...
[tooltips]="false"
></ais-range-slider>