javascript – 如何跟踪角度项目中的“EmptyError:无顺序元素”错误

我正在研究一个抛出错误的Angular项目:core.js:1350 ERROR错误:未捕获(承诺):EmptyError:序列中没有元素,但我似乎无法将其跟踪到我的任何应用程序源代码.堆栈跟踪都指向rxjs类.

任何人都可以告诉我如何调试此错误,以便我可以在代码中找到真正的错误?

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>

解决方法:

此错误是由Angular的路由器的最新版本引起的.
您可以撤消您的版本或将pathMatch:’full’附加到您的所有路线.

github issue.

Example

上一篇:javascript – 如何防止从史诗开始两次相同的调用


下一篇:javascript – 以角度6重试HTTP请求