如果Angular 8路由器无法渲染各种组件,可以尝试以下解决方法:
import { Component1Component } from './components/component1/component1.component';
import { Component2Component } from './components/component2/component2.component';
@NgModule({
declarations: [
AppComponent,
Component1Component,
Component2Component
],
...
})
export class AppModule { }
import { Component1Component } from './components/component1/component1.component';
import { Component2Component } from './components/component2/component2.component';
const routes: Routes = [
{ path: 'component1', component: Component1Component },
{ path: 'component2', component: Component2Component },
...
];
Component 1
Component 2
npm install @angular/router@latest
如果问题仍然存在,可以尝试更新Angular的版本,并确保所有依赖项都是最新的。