I am sharing data across two sibling components using an injectible. In my injectible I am using an observable like this:
@Injectable()
export class DatasService {
message: Observable<string> = new Observable<string>();
changeMessage(){
this.message.next('Arpita'); //Property next doesn't exist
}
changeMessage2(){
this.message.next('Ankan');
}
}
But then when I am using Subject in place of Observable it works fine. I want to use Observable instead of Subject, so is it possible? I am new to reactive programming, and I am confused.