【发布时间】:2019-10-31 04:24:39
【问题描述】:
我有一个 Angular 应用程序,并将自定义数据添加到给出的路由中
{ path: 'profile', component: ProfileComponent, data: {title: 'example'} }
在 app.component.ts 文件中我有以下代码
private route: ActivatedRoute
console.log('route snapshot', this.route.firstChild.data._value.pageType );
我得到的错误是
ERROR in src/app/app.component.ts(71,64): error TS2339: Property '_value' does not exist on type 'Observable<Data>'.
谁能告诉我如何访问 app.component.ts 中的路由数据
【问题讨论】:
标签: javascript angular typescript