sainture
2/25/2018 - 6:37 AM

take() operator

takes the first values


ngOnInit() {
  
  // produces a number every one second
  const numbers$ = Observable.interval(1000);
  
  numbers$.pipe(
    take(5) // take first 5 values from that observable
  )
  .subscribe(x =>  console.log(x); )

}