我想做的是监听地址参数变化:

import 'rxjs/operator/filter';//...this.router.events.filter((event:Event) => event instanceof NavigationEnd).subscribe(x => console.log(x))

但报错如下图显示:

解决方法:

对于RXJS 5.x版本:import 'rxjs/add/operator/filter';对于RXJS 6.x 版本:import { filter } from 'rxjs/operators';
import { filter } from 'rxjs/operators';// ..this.router.events.pipe(filter((event:Event) => event instanceof NavigationEnd)).subscribe(x => console.log(x))
import 'rxjs/operator/filter'; // This is valid import statement.// It will import the operator without // modifying Observable prototype
// ..// Change how the operator is called
filter.call(this.router.events, (event:Event) => event instanceof NavigationEnd
).subscribe(x => console.log(x));

Property 'filter' does not exist on type 'Observable' 报错解决方法相关推荐

  1. property xxx does not exist on type Object报错

    在TypeScript中如果按JS的方式去获取对象属性,有时会提示形如Property 'xxx' does not exist on type 'Object'的错误.下文代码中的'xxx'替换成你 ...

  2. Angular响应式开发中报错Property 'map' does not exist on type 'Observable'.引用rxjs也没用。

    Angular响应式开发源代码如下: import { Component, OnInit } from '@angular/core'; import {Observable} from 'rxjs ...

  3. ONNXImporter::handleNode DNN/ONNX和create layer “onnx::Gather_384“ of type “NonMaxSuppression“报错解决

    今天在调试yolov7模型转化加载问题的时候遇上了很多OpenCV加载模型的报错,由于标题长度限制的问题没有办法完全展示,这里将其完整贴出来. [ERROR:0] global D:\opencv-p ...

  4. 【微信小程序报错解决方法】TypeError: Cannot read property ‘setData‘ of undefined

    场景 自己在调用 wx.getSystemInfo({}) 时,开发工具自动补全了代码.在 success 回调中按照以往的写法调用 this.setData({ }); 时,报错:TypeError ...

  5. [vuex] unknown mutation type: XXX/XXX 报错解决方法

    unknown getter: XXX/XXX 报错解决方法 今天,用vuex中的Module来分割多个模块的时候,碰到了一个bug,今天,跟大家分享一下,先看一下报错内容吧 我的代码结构是这样的 i ...

  6. an integer is required (got type tuple) 报错解决

    今天在调用Opencv的一个函数的时候出现如下报错: 原代码为: blur2 = cv2.boxFilter(img1, (3, 3), normalize=True) 这是在调用一个opencv 图 ...

  7. Property ‘contentWindow‘ does not exist on type HTMLElement,类型htmlelement上不存在contentwindow属性

    一.问题 Property 'contentWindow' does not exist on type HTMLElement 二.解决方法 /*** Property 'contentWindow ...

  8. 响应式编程时出现:error TS2339: Property 'debounceTime' does not exist on type 'Observableany'.

    constructor() {this.searchInput.valueChanges//.debounceTime(500) 无法使用.pipe(debounceTime(1000)).subsc ...

  9. Property ‘next‘ does not exist on type ‘Component<any, {}, any>‘问题的解决方法

    场景:使用antd的Carousel组件时,自定义左右切换按钮,触发组件的next(),prev()方法时报错 错误写法: handleNext(){this.refs.img.next()}< ...

最新文章

  1. android 程序闪退 log,写了一个android小程序,测试的时候闪退,然鹅log并没有报错...
  2. Vijos1451圆环取数[环形DP|区间DP]
  3. 什么防盗门都是浮云~
  4. Andoird --- 安卓 failed to connect to /192.168.0.135 (port 8080) after 1000ms
  5. (常用API)正则表达式邮箱地址验证
  6. android spp传输速度,Android蓝牙SPP连接似乎在几秒后就已经死了
  7. python循环顶帖_python中的循环
  8. 模拟幅度调制系统抗干扰性能仿真分析
  9. Google Colab 详细注册教程
  10. Python3,多线程爬取某瓣小电影~ ~
  11. 跑三小时的monkey测试该怎么算_Android命令Monkey压力测试,详解
  12. 软件测试--如何把5M图片变成10M图片
  13. k8s(四)—service服务(暴露方式:ClusterIP、NodePort、LoadBalancer、ExternalName、ingress)
  14. MySQL审计插件使用和对比
  15. IC技术圈期刊 2021年第2期
  16. Python 搭建一个简易QQ机器人
  17. 由OJ提交结果联想到内存页面大小的一些小猜想
  18. 人——Web3的新平台
  19. 2018年10月训练记录(10.1~10.23)
  20. 一个不错的学习资源列表

热门文章

  1. ubuntu14.04下python2.7推荐系统Crab搭建
  2. 三极晶体管放大电路实验
  3. C#語法學習二(NameSpace)
  4. Rsync 服务安全加固
  5. c语言if case语句怎么用,这样的case和if一起运用有问题吗?
  6. win10更新1809版本后运行Dev-cpp, dos控制台字符乱码解决方法
  7. 报告一个IE很奇葩的滚动条问题——百分比计算宽度为浮点数时的滚动条显示异常
  8. Abp vNext 自定义 Ef Core 仓储引发异常
  9. jxl.read.biff.BiffException: Unable to recognize OLE stream解决方法
  10. 解决Python print输出不换行没空格的问题