Home >Web Front-end >JS Tutorial >Error reported after Angular5 upgrade
This time I will bring you an error after the Angular5 upgrade. What are the precautions for the error after the Angular5 upgrade? The following is a practical case, let's take a look.
Preface
RxJS is a programming tool for asynchronous data flow, or responsive extended programming; no matter how you explain its goals, RxJS It’s asynchronous programming. Angular introduced RxJS to make asynchronous programming controllable and simpler. However, I have encountered some problems during the upgrade recently. Let me introduce them to you and give some reference to friends who also encounter this problem. I won’t go into details below, let’s take a look at the detailed introduction.
Angular 5.0.5 upgraded RxJS to 5.5.3 and reported an error:
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)
This should be caused by the RxJS upgrade, please refer to the issue.
Method 1
Add pathMath: "full" to all routes, such as
const routes: Routes = [ { path: "", component: IndexComponent }, { path: "home", component: HomeComponent }, { path: "about", component: AboutComponent }, ... ];
is changed to
const routes: Routes = [ { pathMatch: 'full', path: "", component: IndexComponent }, { pathMatch: 'full', path: "home", component: HomeComponent }, { pathMatch: 'full', path: "about", component: AboutComponent }, ... ];
Method 2
RxJS is downgraded to version 5.5.2.
Note: Be sure to uninstall the previous version when downgrading.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Using react, redux, react-redux
How to use vue components in actual projects
The above is the detailed content of Error reported after Angular5 upgrade. For more information, please follow other related articles on the PHP Chinese website!