To use the of operator from the rxjs library in Typescript, first you need to import it as follows:
index.ts27 chars2 lines
Then, you can create an observable using the of operator:
index.ts48 chars2 lines
The of operator will emit each of the provided values as separate emissions in the observable stream.
Here's an example that subscribes to observable$ and logs each emitted value to the console:
index.ts48 chars2 linesOutput:
index.ts17 chars4 lines
Note: the $ suffix appended to the observable variable name is a convention in RxJS for indicating that the variable holds an observable.
gistlibby LogSnag