Ais-Toggle | Angular InstantSearch V4 (Deprecated)
Signature
Import
Copy
1
2
3
4
5
6
7
8
import { NgAisToggleModule } from 'angular-instantsearch';
@NgModule({
imports: [
NgAisToggleModule,
],
})
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-toggle
widget provides an on / off filtering feature based on an attribute value.
Examples
1
2
3
4
<ais-toggle
attribute="free_shipping"
label="Free Shipping"
></ais-toggle>
Props
attribute
string
The name of the attribute on which to apply the refinement.
To avoid unexpected behavior, you can’t use the same attribute
prop in a different type of widget.
1
2
3
4
<ais-toggle
attribute="free_shipping"
label="Free Shipping"
></ais-toggle>
label
string
Label to display for the checkbox.
1
2
3
4
<ais-toggle
attribute="free_shipping"
label="Free Shipping"
></ais-toggle>
on
boolean|number|string
The value of the refinement to apply on the attribute when checked.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<ais-toggle
attribute="free_shipping"
label="Free Shipping"
on="yes"
></ais-toggle>
<ais-toggle
attribute="free_shipping"
label="Free Shipping"
[on]="true"
></ais-toggle>
<ais-toggle
attribute="free_shipping"
label="Free Shipping"
[on]="1"
></ais-toggle>
off
boolean|number|string
The value of the refinement to apply on the attribute when unchecked.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<ais-toggle
attribute="free_shipping"
label="Free Shipping"
off="no"
></ais-toggle>
<ais-toggle
attribute="free_shipping"
label="Free Shipping"
[off]="false"
></ais-toggle>
<ais-toggle
attribute="free_shipping"
label="Free Shipping"
[off]="0"
></ais-toggle>