I came across some code in Angular that rotates 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]));
}
Unfortunately, I get the error message "Rx is not found" in on my version of Rx (6.5.5) and Angular (10.0.9). The code seems to be written in an old-style of RxJs. How do I rewrite it in the new style?