【发布时间】:2015-12-25 07:19:47
【问题描述】:
我有一个运行最新 alpha (37) 的 Angular 2 测试应用程序。只有三个路线,如下所示:
@RouteConfig([
{ path: '/', component: Home, as: 'home' },
{ path: '/errors', component: Errors, as: 'errors' },
{ path: '/about', component: About, as: 'about' }
])
我可以访问路由,当我在 URL 中放置查询字符串参数时,我可以很好地阅读它们。但是,在我读取参数后不久,我注意到路由加载正常并且 URL 刷新,删除了查询字符串参数。
也就是说,访问这条路由:
http://localhost:5555/errors?test=abc
加载/errors 路由,但在应用程序加载后URL变成:
这会让用户感到困惑。我想将查询字符串参数保留在 URL 中。
我知道,它处于 alpha 阶段,但这是一个错误还是我忘记在路由器上设置一些东西?如何在 URL 中保留任何查询字符串参数?
谢谢!
【问题讨论】:
标签: javascript angular web angularjs-routing