API Reference / Angular InstantSearch Widgets / simple
Aug. 23, 2019

You are reading the documentation for Angular InstantSearch v3, which is in beta. You can find the v2 documentation here.

Widget signature
simple();

About this widget

The simple state mapping is used by default within ais-instantsearch.

The only transformation applied by the function is the omission of configure.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { simple } from 'instantsearch.js/es/lib/stateMappings';

simple().stateToRoute({
  query: 'Apple',
  page: 5,
  configure: {
    hitsPerPage: 4,
  },
});

// {
//   query: 'Apple',
//   page: 5,
// }

Examples

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { simple } from 'instantsearch.js/es/lib/stateMappings';

@Component({
  template: `
    <ais-instantsearch [config]="config">
      <!-- Widgets -->
    </ais-instantsearch>
  `
})
export class AppComponent {
  config = {
    // ...
    routing: {
      stateMapping: simple()
    }
  };
}

Did you find this page helpful?