Deep Linking in Angular2

I am pretty new to Angular2. Is there a way to do deep linking in Angular2 to say...something like this http://may-app.com/projects/1/files/2?

I can do http://my-app.com/projects/1 with the provided routing and routing parameters in Angular2 with this code

onClick(project){
  this.router.navigate(['/projects', project.id ]);
}

Thanks!

Upvotes: 1

Views: 2536

Answers (1)

Pradeep Prabhu B R
Pradeep Prabhu B R

Reputation: 428

You can achieve it by adding router children.

{ path: 'product/:id', component: ProductDetails,
    children: [          
      { path: 'file/:fileid', component: Overview }

    ]
  }

To read more about deep linking i recommend to read this

https://angular-2-training-book.rangle.io/handout/routing/child_routes.html

Upvotes: 2

Related Questions