InstantSearch / Angular / V4 / API reference

Ais-Range-Slider | Angular InstantSearch V4 (Deprecated)

Deprecated content
Angular InstantSearch is deprecated. Please use InstantSearch.js instead. For more information, see Migrating from Angular InstantSearch.

Signature

Signature
<ais-range-slider
  attribute="string"

  // Optional parameters
  [min]="number"
  [max]="number"
  [precision]="number"
  [pips]="boolean"
  [tooltips]="boolean"
></ais-range-slider>

Import

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

Required
Type: string

The name of the attribute in the record.

1
<ais-range-slider attribute="price"></ais-range-slider>

min

Optional
Type: 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

Optional
Type: 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

Optional
Type: number

The number of digits after the decimal point to use.

1
2
3
4
<ais-range-slider
  // ...
  [precision]="0"
></ais-range-slider>

pips

Optional
Type: boolean

Show slider pips or not.

1
2
3
4
<ais-range-slider
  // ...
  [pips]="false"
></ais-range-slider>

tooltips

Optional
Type: boolean

Show slider tooltips or not.

1
2
3
4
<ais-range-slider
  // ...
  [tooltips]="false"
></ais-range-slider>
Did you find this page helpful?