在Angular中,如果你遇到无法识别名为"History"的路由的问题,可以尝试以下解决方法:
const routes: Routes = [
{ path: 'history', component: HistoryComponent }
];
import { HistoryComponent } from './history.component';
@NgModule({
declarations: [
HistoryComponent
],
// ...
})
export class AppModule { }
import { HistoryComponent } from './history.component';
const routes: Routes = [
{ path: '', component: HistoryComponent }
];
@NgModule({
declarations: [
HistoryComponent
],
// ...
})
export class HistoryModule { }
ng clean
然后重新构建你的应用程序:
ng build
这些解决方法通常可以解决Angular无法识别路由的问题。如果问题仍然存在,请确保你的代码没有其他错误,并且尝试在Angular官方文档或相关论坛中寻求更多帮助。