更改路线PARAMS无角2重装 [英] Change route params without reloading in angular 2

查看:202
本文介绍了更改路线PARAMS无角2重装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做使用角2,谷歌地图房地产网站等,当用户更改我执行指示地图的当前位置以及半径搜索的API地图的中心。问题是,我想反映在url这些值无需重新加载整个页面。那可能吗?我发现采用了棱角分明的1.x,但没有约2角的一些解决方案。

i'm making a real estate website using angular 2, google maps, etc. and when a user changes the center of the map i perform a search to the api indicating the current position of the map as well as the radius. The thing is, i want to reflect those values in the url without reloading the entire page. Is that possible? I've found some solutions using angular 1.x but nothing about angular 2.

推荐答案

您可以使用 location.go(URL)这基本上会改变你的网址,在不改变路线应用。

You could use location.go(url) which will basically change your url, without change in route of application.

注意这可能会导致像从当前路由重定向到孩子航线其他作用。

NOTE this could cause other effect like redirect to child route from the current route.

相关问题 描述 location.go 不会贴心路由器来发生的变化。

Related question which describes location.go will not intimate to Router to happen changes.

这篇关于更改路线PARAMS无角2重装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆