美文网首页
Angular2 隐藏路由参数信息

Angular2 隐藏路由参数信息

作者: CK110 | 来源:发表于2017-03-21 15:01 被阅读808次

shit 一样的官方文档,还是记录一下吧

先看一下子路由配置

    {
        path: '',
        component: CarProFile,
        children: [
            {
                path: 'add',
                component: CarAdd,
            }
        ]

    }
this.router.navigate(['add', { id: this.userid, foo: 'foo' }], { relativeTo: this.route });

然后浏览器的url 是这样的,参数很明显。。。


处理方法 skipLocationChange

this.router.navigate(['add', { id: this.userid, foo: 'foo' }], { relativeTo: this.route , skipLocationChange: true });

相关文章

网友评论

      本文标题:Angular2 隐藏路由参数信息

      本文链接:https://www.haomeiwen.com/subject/gokgnttx.html