While it's possible to use an Object to configure your streams, using a Function gives you much more flexibility to configure streams. This lesson shows how to use the functions to configure and return multiple streams based on the same source.
Instructor: [00:00] rather than using a subscription's object, it's more common to use a subscription's function. The function returns an object with those streams on it. If I create another interval here and say this is observable interval of one second, then I can create a times two, which is interval and mapped to that value times two.
[00:28] We'll duplicate this line and create a times three, which is the same but times three. Then, I can return an object with both of these on there, so times two and times three and render them both out. Instead of message, we'll render out times two and times three.
[00:50] Hit Save here, and you'll see these will update by twos and threes because we have a function returning an object with multiple streams on it...
Only way I could get it working as well Christopher.
I had to use pipe to get this to work.
I imported map import {map} from 'rxjs/operators'
Then used pipe like this interval$.pipe(map(i => i * 2))
Please somebody correct me if this isn't correct.