Complete the code to import the Observable class from RxJS.
import { [1] } from 'rxjs';
The Observable class is imported from 'rxjs' to create streams of data in Angular.
Complete the code to subscribe to an observable and log the emitted value.
myObservable.subscribe({ next: value => console.[1](value) });The log method prints the emitted value to the console when the observable emits data.
Fix the error in the code to correctly create an observable that emits 'Hello'.
const hello$ = new Observable(observer => { observer.[1]('Hello'); observer.complete(); });The next method is used to send data to subscribers of the observable.
Fill both blanks to create an observable that emits numbers 1 to 3 and then completes.
const numbers$ = new Observable(observer => { observer.[1](1); observer.[1](2); observer.[1](3); observer.[2](); });Use next to emit values and complete to signal the end of the stream.
Fill all three blanks to create a dictionary comprehension that maps each emitted value to its square if the value is greater than 2.
const squares = { [1]: [2] for [3] of values if [3] > 2 };Use 'value' as the key and 'value * value' as the value, iterating over 'value' in values, filtering with 'value > 2'.