angular - routerlink:错误错误:“[对象对象]”
问题描述
我在我的 CRUD 应用程序中使用 Angular 6,并且我有这样的组件结构:
root: app.component
- topic.component
- create-topic.componentI
- answer.component
我有一个按钮,topic.component
其中有一个routerlink
to create-topic component
:
<a routerLink="add-topic">
<button type="button" class="btn btn-primary ">New Topic</button>
</a>
在我的模板中topic.component
,我想在其中显示以下模板create-topic
:
<div class="container-fluid">
<router-outlet></router-outlet>
</div>
这是配置app.routing.module
const routes: Routes = [
{path: 'add-topic', component: CreateTopicComponent }
]
我拥有的所有其他路线都在工作,除了这条路线,每次我点击按钮我都会得到这个:
ERROR 错误:“[object Object]”
resolvePromisehttp://localhost:4200/polyfills.js:5787:31
resolvePromisehttp://localhost:4200/polyfills.js:5744:17
scheduleResolveOrRejecthttp://localhost:4200/polyfills.js :5846:17
invokeTaskhttp://localhost:4200/polyfills.js:5394:17
onInvokeTaskhttp://localhost:4200/vendor.js:58217:24
invokeTaskhttp://localhost:4200/polyfills.js:5393:17
runTaskhttp ://localhost:4200/polyfills.js:5161:28
drainMicroTaskQueuehttp://localhost:4200/polyfills.js:5568:25
invokeTaskhttp://localhost:4200/polyfills.js:5473:21
invokeTaskhttp://localhost: 4200/polyfills.js:6513:9
globalZoneAwareCallbackhttp://localhost:4200/polyfills.js:6539:17
我不知道在哪里看,这个错误意味着什么?我错过了什么?我找不到与我的问题类似的任何其他 stackoverflow 问题。