How do I listen to the VideoClient events in angular?

Description
When an event takes place, say a user is added to the meeting, an event “user-added” occurs to which the client.on() function listens. How do I listen to these events in angular?
Angular does not allow me to directly call a function inside of a component and I can’t call it outside of it as my videoClient object exists only inside the components.
Please help.

Error
N/A

Which Web Video SDK version?
VideoSDK 1.1.4

To Reproduce(If applicable)
N/A

Screenshots
N/

Device (please complete the following information):
N/A

Additional context
In the documentation the client.on() functions are just called from inside of the script. So that didn’t help me at all.

Hey @devagyas900 ,

You can add the event listeners in your Angular constructor function. Example:

constructor() {
    this.client.on('user-added',(payload)=>{
    // You can refresh the participants when
    const participants = this.client.getParticipantsList();
   })
}

Let me know if that helps! :slight_smile:

Thanks,
Tommy

1 Like

Thanks a lot, @tommy
It works.

1 Like

You are welcome! :slight_smile:

-Tommy