Angular2入门系列(五)———— 路由参数设置

Angular2入门系列(五)———— 路由参数设置
路由配置:浏览器

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

    }

路由跳转:

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

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

![图片上传中...]code

处理方法 skipLocationChangecomponent

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

注意:用此方法处理后,会致使页面的后退按钮失效。router

相关文章
相关标签/搜索