问题
I'm working on an Angular project that's throwing an error: core.js:1350 ERROR Error: Uncaught (in promise): EmptyError: no elements in sequence but I can't seem to trace it to any of my app source code. The stack trace all points to rxjs classes.
Can anyone tell me how I can debug this error so that I can get to the real error in the code?
core.js:1350 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 ArrayObservable._subscribe (ArrayObservable.js:124)
at ArrayObservable.Observable._trySubscribe (Observable.js:172)
at ArrayObservable.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 ArrayObservable._subscribe (ArrayObservable.js:124)
at ArrayObservable.Observable._trySubscribe (Observable.js:172)
at ArrayObservable.Observable.subscribe (Observable.js:160)
at resolvePromise (zone.js:824)
at resolvePromise (zone.js:795)
at eval (zone.js:873)
at ZoneDelegate.invokeTask (zone.js:425)
at Object.onInvokeTask (core.js:4621)
at ZoneDelegate.invokeTask (zone.js:424)
at Zone.runTask (zone.js:192)
at drainMicroTaskQueue (zone.js:602)
at <anonymous>
回答1:
This bug is due to the last version of Angular's Router.
You can reverse your version or append pathMatch: 'full' to all of your routes.
See github issue.
Example
来源:https://stackoverflow.com/questions/47612171/how-do-i-trace-an-emptyerror-no-elements-in-sequence-bug-in-an-angular-projec