Please give me a solution for that question. I want to pass a custom object using service.
private messageSource = new Subject();
changeMessage(m
You can create a subject inside your service
messageSource: Subject;
and instantiate inside your constructor
this.messageSource = new Subject();
in your component you can do this,
this.yourService.messageSource.next('whatvermessage');
and if you want to subscribe to it, you can do
this.yourService.messageSource.asObservable().subscribe((value: string) => {
});