Observable in service


#1

Hi, i wanna use Observable in my service, so my pages can subscribe to it and automatically received updates of data in service. Can i for example expose some property as Observable? And how this can be done? If i use Observable.of(), it emits data just once, but i want Observable to emit every time some variable is updated. Or is Subject better for this?

And is this a proper way to share data between pages and keep them updated?


#2

See here for an example using ReplaySubject and Observable: