I am using angular 2.0, specifically the routing features for the purposes of this question. The way I have set up my routing looks like this.
const routes: Routes = [
{ path : ':filePath', component: ParentDisplayComponent,
children : [
{ path : 'metadata', component: MetadataDisplayComponent },
{ path : 'data', component : DataDisplayComponent }
]
}
];
So as you can see, a url of mine might end up looking like this.
<host>:<port>/#/<file path>/metadata
However, because I am making a file browser of sorts, my "file paths" (the initial parameter) look like this.
/foo/bar/baz
In order to make this work, I've had to escape the slashes, so now my urls end up looking like this
<host>:<port>/#/%252ffoo%252fbar%252fbaz/metadata
I know that this is more or less "fine", but I seriously hate the look of this, and it isn't very user friendly, as far as manually entering the url. Does anyone have any suggestions on how to make my urls more user friendly? I kind of do need a parent level component that keeps track of the chosen file, which is why I didn't do something like this.
<host>:<port>/#/metadata?path=/foo/bar/baz
The reason for this is that I want my app to have a "browser" (similar to windows explorer) on the left side of the screen at all times, with a swappable component in the middle of the screen. Picture something like this.
___________________________
|___________________________|
| |
|file a | ____________________
|file b | |swappable component|
|file c | ---------------------
|etc... |
That's probably enough rambling. Does anyone have any ideas as far as making my urls nicer, considering that I must have parameters containing slashes?