文档介绍
Angular4.x中的路由主讲教师:(大地)合作网站:(IT营)合作网站:(Ionic中文网)目录一、Angular命令创建一个配置好路由的项目1二、Angula4.x在已有的项目中配置路由3三、AngularrouterLink页面跳转默认跳转路由5四、AngularrouterLinkActive设置routerLink默认选中路由6五、路由的动态传值6六、路由的js跳转7七、路由的js跳转get传值8八、父子路由9一、Angular命令创建一个配置好路由的项目1.命令创建项目ngnewdemo02–-routing2.创建需要的组件nggcomponenthomenggcomponentnewsnggcomponentnewscontent3.找到app-routing.module.ts配置路由引入组件import{HomeComponent}from'./home/ponent';import{NewsComponent}from'./news/ponent';import{NewscontentComponent}from'./newscontent/ponent';配置路由constroutes:Routes=[{path:'home',component:HomeComponent},{path:'news',component:NewsComponent},{path:'newscontent/:id',component:NewscontentComponent},{path:'',redirectTo:'/home',pathMatch:'full'}];4.找到ponen