我有一个角度为6的PWA,一切都很好,并且一直工作到启用polyfills为止。现在,当我运行ngserve并尝试导航到另一个组件时,它只会出错,并且路由器出口变为空白。
我有一个类似的应用程序,可以很好地运行,并查看我是否用这些polyfill破坏了某些东西-我只是复制粘贴了polyfills文件并获得了相同的结果。
我也曾尝试运行ng serve --prod,但结果完全相同。
我还注释了除反射和区域之外的默认填充,因为默认情况下启用了这些填充,现在行为仍然存在。不知道还有什么可以尝试的。
ERROR Error: "[object Object]"
resolvePromisehttp://localhost:4200/polyfills.js:7406:31resolvePromisehttp://localhost:4200/polyfills.js:7363:17scheduleResolveOrRejecthttp://localhost:4200/polyfills.js:7465:17invokeTaskhttp://localhost:4200/polyfills.js:7013:17onInvokeTaskhttp://localhost:4200/vendor.js:62603:24invokeTaskhttp://localhost:4200/polyfills.js:7012:17runTaskhttp://localhost:4200/polyfills.js:6780:28drainMicroTaskQueuehttp://localhost:4200/polyfills.js:7187:25invokeTaskhttp://localhost:4200/polyfills.js:7092:21invokeTaskhttp://localhost:4200/polyfills.js:8132:9globalZoneAwareCallbackhttp://localhost:4200/polyfills.js:8158:17 core.js:1673
defaultErrorLogger
core.js:1673
./node_modules/@angular/core/fesm5/core.js/ErrorHandler.prototype.handleError
core.js:1719
next
core.js:4311:109
./node_modules/@angular/core/fesm5/core.js/EventEmitter.prototype.subscribe/schedulerFn<
core.js:3551:34
./node_modules/rxjs/_esm5/internal/Subscriber.js/SafeSubscriber.prototype.__tryOrUnsub
Subscriber.js:195
./node_modules/rxjs/_esm5/internal/Subscriber.js/SafeSubscriber.prototype.next
Subscriber.js:133
./node_modules/rxjs/_esm5/internal/Subscriber.js/Subscriber.prototype._next
Subscriber.js:77
./node_modules/rxjs/_esm5/internal/Subscriber.js/Subscriber.prototype.next
Subscriber.js:54
./node_modules/rxjs/_esm5/internal/Subject.js/Subject.prototype.next
Subject.js:47
./node_modules/@angular/core/fesm5/core.js/EventEmitter.prototype.emit
core.js:3535:52
onHandleError/<
core.js:3842:48
./node_modules/zone.js/dist/zone.js/</ZoneDelegate.prototype.invoke
http://localhost:4200/polyfills.js:6980:17
./node_modules/zone.js/dist/zone.js/</Zone.prototype.run
http://localhost:4200/polyfills.js:6730:24
./node_modules/@angular/core/fesm5/core.js/NgZone.prototype.runOutsideAngular
core.js:3779
onHandleError
core.js:3842
./node_modules/zone.js/dist/zone.js/</ZoneDelegate.prototype.handleError
http://localhost:4200/polyfills.js:6984:17
./node_modules/zone.js/dist/zone.js/</Zone.prototype.runGuarded
http://localhost:4200/polyfills.js:6746:25
_loop_1
http://localhost:4200/polyfills.js:7269:21
./node_modules/zone.js/dist/zone.js/</</api.microtaskDrainDone
http://localhost:4200/polyfills.js:7278:17
drainMicroTaskQueue
http://localhost:4200/polyfills.js:7194:13
./node_modules/zone.js/dist/zone.js/</ZoneTask.invokeTask
http://localhost:4200/polyfills.js:7092:21
invokeTask
http://localhost:4200/polyfills.js:8132:9
globalZoneAwareCallback
http://localhost:4200/polyfills.js:8158:17
答案 0 :(得分:1)
这是由于以错误的方式取消订阅onDestroy。
我正试图取消订阅已创建的某些订阅,但是由于某种奇怪的原因而导致出现错误,现在我已解决了该问题,routerLink再次可以工作。