Angular5升级RxJS到5.5.3报错:EmptyError: no elements in sequence的解决方法
程序员文章站
2023-02-21 19:54:41
前言
rxjs是一种针对异步数据流编程工具,或者叫响应式扩展编程;可不管如何解释rxjs其目标就是异步编程,angular引入rxjs为了就是让异步可控、更简单。可是最近...
前言
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。
注意:降版本时一定要把之前的卸载掉。
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对的支持。
上一篇: 女生适合读的十大工科专业:生物医学上榜,第十女生很少
下一篇: 羊腿要煮多久才熟