简体   繁体   English

read.ts(6133)模块'“ ../../../node_modules/rxjs/observable/combineLatest”'没有导出的成员'combineLatest'.ts(2305)

[英]read.ts(6133) Module '“../../../node_modules/rxjs/observable/combineLatest”' has no exported member 'combineLatest'.ts(2305)

How to combine Observables by combineLatest. 如何通过CombineLatest合并Observable。 combineLatest is not defined 未定义CombineLatest

I am using angular js 7.I want to marge tow query string parameter but when I write the obserable.combinelaste([]) then it will give en error. 我正在使用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=>{

    });
  }

}

You import is wrong. 您输入错误。 You used the import for RXJS v5. 您将导入用于RXJS v5。

For RxJS v6+, you should use this import : 对于RxJS v6 +,您应该使用以下导入:

import { combineLatest } from 'rxjs';

To solve the following error message : 解决以下错误信息:

ngOnInit() { Observable.combineLatest([ this.rout.paramMap, this.rout.queryParamMap ]); ngOnInit(){Observable.combineLatest([this.rout.paramMap,this.rout.queryParamMap]); Property 'combineLatest' does not exist on type 'typeof Observable 类型“ typeof Observable”上不存在属性“ combineLatest”

You can use combineLatest like this : 您可以像这样使用combineLatest

combineLatest(this.rout.paramMap, this.rout.queryParamMap)

And you probably have to spend some time to read how to use it: https://www.learnrxjs.io/operators/combination/combinelatest.html 您可能需要花一些时间来阅读如何使用它: https : //www.learnrxjs.io/operators/combination/combinelatest.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NestJS 'type' 已声明,但它的值永远不会被读取。ts(6133) - NestJS 'type' is declared but its value is never read.ts(6133) 错误 TS2305:模块 @types/angular 没有导出的成员“cookies” - Error TS2305: Module @types/angular has no exported member 'cookies' Angular 2.0路由 - TS 2305 ...没有导出成员'ModulewithProviders' - Angular 2.0 routing - TS 2305 … has no exported member 'ModulewithProviders' combineLatest 重置 observable - Rxjs - combineLatest reset observable - Rxjs ngx-chess-board.component.d.ts:75:21 - 错误 TS2694:命名空间 '"/node_modules/@angular/core/core"' 没有导出成员 'ɵɵFactoryDeclaration' - ngx-chess-board.component.d.ts:75:21 - error TS2694: Namespace '"/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration' 使用 node.js 并发现此错误 > 'server' 已声明,但其值从未读取。ts(6133) > from "var server = app.listen(3000, listener);" - using node.js and found this error > 'server' is declared but its value is never read.ts(6133) > from "var server = app.listen(3000, listening);" Vue 和 Quasar - 模块 '“../../node_modules/vue/types”' 没有导出的成员 'defineComponent' - Vue and Quasar - Module '“../../node_modules/vue/types”' has no exported member 'defineComponent' 模块 '"./node_modules/react-native"' 没有导出的成员 'View' - Module '"./node_modules/react-native"' has no exported member 'View' RxJS combineLatest 仅将计时器添加到一个可观察对象 - RxJS combineLatest add timer to only one observable node_modules/rxjs-compat/operator/shareReplay.d.ts(2,10) 中的错误: - ERROR in node_modules/rxjs-compat/operator/shareReplay.d.ts(2,10):
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM