While exploring some Angular code, I stumbled upon a snippet that switches between words every few seconds:
words: string[] = ['foo', 'bar', 'baz'];
word = null;
rotateWords() {
const source = Rx.Observable.interval(1000).take(this.words.length);
const sub = source.finally(this.rotateWords).subscribe(i => this.word = this.words[i]));
}
However, when running it on my version of Rx (6.5.5) and Angular (10.0.9), I encounter the error message "Rx is not found". This code appears to be using an outdated format of RxJs. How can I adapt it to the new syntax?