angular2 路由导航补遗
来源:互联网 发布:mac口红一盒 编辑:程序博客网 时间:2024/05/20 02:23
先看路由表
export const parentRoutes:RouterConfig=[
{path:'',redirectTo:'parent',pathMatch:'full'},
{path:'parent',component:parent,
children:[
{path:'home',component:home},
{path:'child',component:child},
{path:'',redirectTo:'home',pathMatch:'full'}
]
}
]
绝对路径
绝对路径是以“/”开头,,需要使用完整路由并与路由表一致如:
<a [routerLink]="['/parent/child']">link to child</a>
命令行:this.router.navigate(['/parent/child'])
相对路径
相对路径以“../”(上级目录),或“./”开头(当前目录),是指相对于当前组件的
<a [routerLink]="['../child']">link to child</a>
命令行:constructor(private router:Router, private route:ActivatedRoute) {
}
onClick() {
this.router.navigate(['./child'], {relativeTo: this.route});
}
注意这里使用了ActivatedRoute,指当前相对于当前的路由
- angular2 路由导航补遗
- Angular2 之 路由与导航
- angular js 路由导航补遗
- angular2.0之路由与导航
- angular2.0路由与导航二
- angular2系统学习 - 路由与导航(2)
- angular2系统学习 - 路由与导航(3)
- angular2系统学习 - 路由与导航(4)
- angular2系统学习 - 路由与导航(5)
- angular2之路由与导航(一)
- angular2系统学习 - 路由与导航(1)基础篇
- angular2路由
- angular2 路由
- Angular2-路由
- ANGULAR2 深入学习路由
- Angular2之二级路由
- angular2地址栏读取路由
- angular2 路由策略 LocationStrategy
- (四)、类型转换
- hdu 1754 I Hate it(线段树的单节点更新,求区间最大值)
- Zzuli OJ-----1894简单DP
- HDU 4324 Triangle LOVE (拓扑排序)
- findViewById==null? 小心android编译器的命名陷阱
- angular2 路由导航补遗
- RectF类
- 【Codeforces】-702C-Cellular Network(二分)
- hdu4418 Time travel 【期望+dp】
- php后台跨域解决
- 关于我的幸福爱情总结
- 爬某个音乐网站上的音乐程序
- JS代码优化一:谷歌浏览器的timeline工具的使用
- jQuery对象和DOM对象相互装换