Base use-case
Rather than adding InstantSearch to a component directly, store the instance in a service and expose utility methods. You can reuse a single instance across multiple components and start it from just one component.JavaScript
Javascript
ngOnInit.
Start the instance in a single component with ngAfterContentInit.
Use connectors to track state changes and bind data to your components.
JavaScript
HTML
Server-side rendering and routing
Because this service reads the Angular Router’s initial state, routing integration works out of the box. Server-side rendering also works without extra code, as Angular renders the page with the initial state coming from the network request.JavaScript
Multi-index
Theindex widget supports multiple indices.
JavaScript