What is equivalent functionality in Angular?

#1

Using the vanilla instantsearch.js, I made use of onRenderCallBack. What is the equivalent in Angular?

Thanks
Eric

#2

Hi @ecoffman,

Just want to make sure we’re on the same page: you’re speaking about the event that is emitted at the instance level? Here is an example of its usage:

const search = instantsearch({
  // ...
});

search.on("render", () => {
  // Trigger something on render
});

If this is what you’re referring to Angular InstantSearch provides a similar solution. It’s undocumented at the moment but the API is available. You can listen to change event on the ais-instantsearch component. Note that the event is called change but it’s the same than render. Here is an example of its usage:

@Component({
  template: `
    <ais-instantsearch [...] (change)="handleChange($event)">
     ...
    </ais-instantsearch>
  `
})
export class AppComponent {
  handleChange({ results, state }) {
    console.log("change", results, state);
  }
}

Hope that helps!

2 Likes
#3

Oops. Of course I mean ‘.on(‘render’, this.onRenderCallBack);’ :slight_smile: .
Sorry for that.

This solved what I am trying to implement with your help. Thanks!!! :smile: