Angular2-router: How to only change a parameter of a route?

前端 未结 2 1358
情歌与酒
情歌与酒 2021-02-06 01:56

I want to have the following routes in my application:

export const routes: Routes = [
    { 
       path: \':universityId\', 
       component: UniversityCompon         


        
2条回答
  •  天命终不由人
    2021-02-06 02:40

    This is very simple. You can simply try to use this.router.navigate(["../2", "courses", "open"], {relativeTo: this.route});

    (or)

    this.router.navigate(["../2", "courses/open"], {relativeTo: this.route});

    This will redirect you to ../2/courses/open.

提交回复
热议问题