Is there a reason why you need to switch to a separate view on each click? Would it be easier to just update the current view with some type of bootstrap representing your file system traversal?
Having said that, you can always do something like this.
Customizing your paths with @RouteConfig:
@RouteConfig([ {path:'/', name:'Home', component:HomeComponent}, {path:'/dir/:name', name:'Dir',component:DirComponent} ])
An example of how you could pass the name dir as the url parameter:
<a [routerLink]="['Dir',{name:'MyDirectory'}]">Profile</a>
Then, inside the constructor of your DirComponent, you can get this parameter:
constructor(private params: RouteParams) { let dirName = params.get('name'); }
The basic concept is that in your main component you can pass the directory name and pass it to another route as a url parameter.
Once again, I would suggest rethinking why you need a separate route for each directory traversal, but this should give you one option for transferring information between components.
I would also like to explore the possibility of sharing data between parent / child components. This may be another option if you need data available for multiple components.
user2263572
source share