您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關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。
注意:降版本時一定要把之前的卸載掉。
感謝各位的閱讀!關于“Angular5升級RxJS到5.5.3報錯怎么辦”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。