Angular Observable Subscribe
A sequence of data emited asynchronously (most of the times) over period of time.
An observer continously listens to an observer to keep track of data changes.
The subscribe method listens to the data / error sent by the observable.
Used when data doesn't being emited does not change. Only listen once. Stop listening for more data changes i.e. activate user.
There are two ways to create observables -
- Using RxJS (using the of operator)
- Using the new 'Observable' keyword (using an observer and subscribe)
Note: Always add $ to variables to identify it as an observable