Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. import { from } from 'rxjs';
  2. import { map, switchMap } from 'rxjs/operators';
  3.  
  4. const featureObservable = from([‘A’, ‘B’]);
  5. featureObservable.pipe(
  6. map(feature => getRequirement(feature)),
  7. switchMap(req => getPlanning(req))
  8. ).subscribe( work => console.log(work));
  9.  
  10.  
  11.  
  12. // Console Output
  13. $ Work A #1 is Done!
  14. $ Work A #2 is Done!
  15. $ Work B #1 is Done!
  16. $ Work B #2 is Done!
  17. $ Work B #3 is Done!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement