登录  /  注册
首页 > web前端 > js教程 > 正文

怎么解决Angular5升级RxJS到5.5.3报错问题

php中世界最好的语言
发布: 2018-05-25 15:18:46
原创
2067人浏览过

这次给大家带来怎么解决Angular5升级RxJS到5.5.3报错问题,解决Angular5升级RxJS到5.5.3报错的注意事项有哪些,下面就是实战案例,一起来看一下。

前言

RxJS是一种针对异步数据流编程工具,或者叫响应式扩展编程;可不管如何解释RxJS其目标就是异步编程,Angular引入RxJS为了就是让异步可控、更简单。可是最近在升级中遇到了一些问题,下面就来给大家介绍下,给同样遇到这个问题发朋友们一些参考,下面话不多说了,来一起看看详细的介绍吧。

Angular 5.0.5升级RxJS到5.5.3报错:

ERROR Error: Uncaught (in promise): EmptyError: no elements in sequence
EmptyError: no elements in sequence
 at new EmptyError (EmptyError.js:28)
 at FirstSubscriber._complete (first.js:154)
 at FirstSubscriber.Subscriber.complete (Subscriber.js:122)
 at MergeMapSubscriber._complete (mergeMap.js:150)
 at MergeMapSubscriber.Subscriber.complete (Subscriber.js:122)
 at MapSubscriber.Subscriber._complete (Subscriber.js:140)
 at MapSubscriber.Subscriber.complete (Subscriber.js:122)
 at EmptyObservable._subscribe (EmptyObservable.js:83)
 at EmptyObservable.Observable._trySubscribe (Observable.js:172)
 at EmptyObservable.Observable.subscribe (Observable.js:160)
 at new EmptyError (EmptyError.js:28)
 at FirstSubscriber._complete (first.js:154)
 at FirstSubscriber.Subscriber.complete (Subscriber.js:122)
 at MergeMapSubscriber._complete (mergeMap.js:150)
 at MergeMapSubscriber.Subscriber.complete (Subscriber.js:122)
 at MapSubscriber.Subscriber._complete (Subscriber.js:140)
 at MapSubscriber.Subscriber.complete (Subscriber.js:122)
 at EmptyObservable._subscribe (EmptyObservable.js:83)
 at EmptyObservable.Observable._trySubscribe (Observable.js:172)
 at EmptyObservable.Observable.subscribe (Observable.js:160)
 at resolvePromise (zone.js:824)
登录后复制

这应该是RxJS升级导致的,参考issue。

方法一

在所有的route里加上pathMath:"full",如

const routes: Routes = [
 { path: "", component: IndexComponent },
 { path: "home", component: HomeComponent },
 { path: "about", component: AboutComponent },
 ...
];
登录后复制

改为

const routes: Routes = [
 { pathMatch: 'full', path: "", component: IndexComponent },
 { pathMatch: 'full', path: "home", component: HomeComponent },
 { pathMatch: 'full', path: "about", component: AboutComponent },
 ...
];
登录后复制

方法二

RxJS降为版本5.5.2。

注意:降版本时一定要把之前的卸载掉。

相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

推荐阅读:

怎样对webpack模块进行热替换

怎样搭建vue2.0+boostrap项目

以上就是怎么解决Angular5升级RxJS到5.5.3报错问题的详细内容,更多请关注php中文网其它相关文章!

智能AI问答
PHP中文网智能助手能迅速回答你的编程问题,提供实时的代码和解决方案,帮助你解决各种难题。不仅如此,它还能提供编程资源和学习指导,帮助你快速提升编程技能。无论你是初学者还是专业人士,AI智能助手都能成为你的可靠助手,助力你在编程领域取得更大的成就。
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号