Angular2-将URL作为路由参数传递
我正试图找到一个有效的解决方案,将完整的URL作为Angular2应用程序中一个路由的参数传递 以下是我的app-routing.module.ts文件的片段:Angular2-将URL作为路由参数传递,angular,Angular,我正试图找到一个有效的解决方案,将完整的URL作为Angular2应用程序中一个路由的参数传递 以下是我的app-routing.module.ts文件的片段: const routes: Routes = [ { path : '', component : HomePageContentComponent }, { path : 'explore', component : ExploreRosFacetedSearchPageContentCompone
const routes: Routes = [
{
path : '',
component : HomePageContentComponent
},
{
path : 'explore',
component : ExploreRosFacetedSearchPageContentComponent
},
{
path : 'explore/:keyword',
component : ExploreRosFacetedSearchPageContentComponent
},
{
path : 'rodetails',
component : RoDetailsComponent
},
{
path : 'rodetails',
component : RoDetailsComponent,
children : [
{
path : 'overview/:uri',
component : OverviewComponent
},
当我在web浏览器中传递例如localhost:4200/rodetails/overview/时,我希望使用此参数执行我的“overview”组件。问题是:因为参数中的URL没有编码-Angular引擎可能不知道它实际上是一个参数,因为其中包含'/'字符。它试图用路由路径overview/http/查找组件,并在无法获取/rodetails/overview/时崩溃
如果有人以前处理过类似的问题,或者知道如何处理这个用例,我非常感谢任何见解 为什么不直接使用查询参数
?url=http://someaddress.com
为什么不编码url并通过查询参数传递它呢?为什么不只使用查询参数?url=http://someaddress.com
为什么不编码url并通过查询参数传递它呢?