[英]NestJS 'type' is declared but its value is never read.ts(6133)
[英]read.ts(6133) Module '“../../../node_modules/rxjs/observable/combineLatest”' has no exported member 'combineLatest'.ts(2305)
如何通过CombineLatest合并Observable。 未定义CombineLatest
我正在使用angular js7。我想添加两个查询字符串参数,但是当我编写obserable.combinelaste([])时,它将给出en错误。
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable, of, observable } from 'rxjs'
import { combineLatest } from 'rxjs/observable/combineLatest';
@Component({
selector: 'app-githubfollowers',
templateUrl: './githubfollowers.component.html',
styleUrls: ['./githubfollowers.component.css']
})
export class GithubfollowersComponent implements OnInit {
constructor(private rout:ActivatedRoute ) { }
ngOnInit() {
Observable.combineLatest([ this.rout.paramMap,
this.rout.queryParamMap
]);
this.rout.paramMap.subscribe(prams=>{
});
this.rout.queryParamMap.subscribe(prams=>{
});
}
}
您输入错误。 您将导入用于RXJS v5。
对于RxJS v6 +,您应该使用以下导入:
import { combineLatest } from 'rxjs';
解决以下错误信息:
ngOnInit(){Observable.combineLatest([this.rout.paramMap,this.rout.queryParamMap]); 类型“ typeof Observable”上不存在属性“ combineLatest”
您可以像这样使用combineLatest
:
combineLatest(this.rout.paramMap, this.rout.queryParamMap)
您可能需要花一些时间来阅读如何使用它: https : //www.learnrxjs.io/operators/combination/combinelatest.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.