VM95422:27 ORIGINAL EXCEPTION:
WEBPACK_IMPORTED_MODULE_3_rxjs_Observable.Observable.zip is not a function
试过各种进口
// import 'rxjs/add/operator/zip'; // import 'rxjs/add/observable/zip-static'; // import 'rxjs/add/operator/zip'; import 'rxjs/operator/zip';
试着像这样使用它:
const zippedUsers: Observable<User[]> = Observable.zip<User>(this.usersObservable);
Angular 4,TypeScript 2.1.6
的package.json:
"rxjs": "^5.1.0",
也许是这样的
原文链接:https://www.f2er.com/angularjs/141789.htmlimport {Observable} from "rxjs/Observable"; import "rxjs/add/observable/zip";
然后像:
Observable.zip(this.someProvider.getA(),this.someProvider.getB()) .subscribe(([a,b]) => { console.log(a); console.log(b); });