Home > Software engineering >  Access variable value for all users in angular
Access variable value for all users in angular

Time:01-21

I have this service variable

Service:

  Users:BehaviorSubject<Array<any>> = new BehaviorSubject([]);

updating these values in component

 this.Service.Users.next([...this.Service.Users.value, ID]);

fetching values like this

this.Service.Users.subscribe(x=>{

});

i want if this variable values is updated by any user it should reflect in all the users component like right now only one who has updated the value has the value other users opened in other browser don't have the updated value.

Thanks

CodePudding user response:

you should use socket programming in angular for this , this is not possible by rxjs observable.

  • Related