一、配置路由
**1、创建项目时选择路由**
**2、在app-routing.module.ts文件中引入组件并配置路由**
import { NewsComponent } from './components/news/news.component';import { HomeComponent } from './components/home/home.component';import { ProductComponent } from './components/product/product.component';const routes: Routes = [{path:'home',component:HomeComponent},{path:'news',component:NewsComponent},{path:'product',component:ProductComponent}
];
**3、在根组件**
<router-outlet></router-outlet>
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!