Direct Slash in Angular Route Options

How do I set up routes so that my parameter can take slashes?

For example: myapp.com/file/rootfolder/subfolder/myfile

This does not work:

const SECTION_ROUTES: Routes = [
    { path: 'file/:path', component: FileStoreComponent }
];

Is it possible to have / in the parameters of the routing parameter?

I read about URL encodings using URL encoding. However, I want my user to be able to enter a URL.

+4
source share
1 answer

It looks like you need to escape every slash with a wildcard:

/*page

This question covers this: Angular2 RouterLink breaks routes, replacing% 2F with a slash

GitHub: https://github.com/angular/angular/issues/8049

0

Source: https://habr.com/ru/post/1680356/


All Articles