首页 > 解决方案 > 未捕获的类型错误:无法读取未定义的属性“ats”

问题描述

我正在使用 Angular 构建一个项目,每当我更改路线时,我都会 Uncaught TypeError: Cannot read property 'ats' of undefined在控制台中收到此错误,但应用程序没有崩溃,并且项目中没有任何名为“ats”的内容。

有人知道为什么会这样吗?

这是我的路由模块

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { BrowseComponent } from './browse/browse.component';
import { HomeComponent } from './home/home.component';

const routes: Routes = [
  { path: 'home', component: HomeComponent },
  { path: 'browse', component: BrowseComponent },
  { path: '',   redirectTo: '/home', pathMatch: 'full' },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

这是来自 Chrome 控制台的错误

标签: angulartypeerror

解决方案


推荐阅读