3
votes

I am using angular 6 as well as read about pipe but didn't get any proper syntax to write zip and imported zip as well.
Error: Property 'zip' does not exist on type 'typeof Observable'.

import { zip } from 'rxjs/operators';

callZipFunction(): void {
            Observable
            .zip( this.commonService.GetMethodA(), this.commonService.GetMethodB())
            .subscribe(([a,b])=>{
            console.log(a);
            console.log(b);
            });
        }
3
What version of rxjs are you trying to use?dmcgrandle
"rxjs": "~6.3.3"Kiran Solkar
then try import { zip } from 'rxjs'; and remove the Observable and the dot in front of .zip ...dmcgrandle
You're welcome. :)dmcgrandle

3 Answers

3
votes

Try to import this way

import {Observable} from "rxjs/Observable";
import "rxjs/add/observable/zip";

Refrence

2
votes

@dmcgrandle Thanks for resolving the Issue

import { zip  } from 'rxjs';

    callZipFunction(): void {
        zip( this.commonService.GetMethodA(), this.commonService.GetMethodB())
        .subscribe(([a,b])=>{
        console.log(a);
        console.log(b);
        });
    }
0
votes

If you have code this like;

  let source$ = Observable.range(0, this.value).zip(
   Observable.timer(0, 1000),
   (x) => { return x }
  ).map(x => {
   return this.value - x
  });        

Add;

    import "rxjs/add/operator/map";
    import "rxjs/add/operator/zip";