What is the of()
function in TypeScript/Angular?
For example, https://angular.io/tutorial/toh-pt5 has a reference to: return of(HEROES);
I found the reference to the Observable of()
function:
In the sample TOH code url I provided at the first url, the of()
function is used independently as opposed to being used with explicit dot notation off an Observable object.
Does the Angular component at the first url I provided maintain some type of implicit component-scoped Observable reference which eliminates the need to call the of() function explicitly via dot notation off of the Observable object? The Observable documentation states:
Observable.of(...items)—Returns an Observable instance that synchronously delivers the values provided as arguments.
TOH is generally the baseline reference model to use for ng development. Is Observable.of()
generally considered the default way to return data in ng6? When was the of()
function introduced. I don't remember seeing it before ng6?