[英]AngularJS UI-Router navigate without removing query params
I'm using UI-Router to manage the states of my application, and I have query params where I save some data about the application. 我正在使用UI-Router来管理应用程序的状态,并且具有查询参数,可以在其中保存有关该应用程序的一些数据。
I'm using ui-sref
no navigate to another state, but this removes the query params from the URL. 我正在使用ui-sref
no导航到另一个状态,但这会从URL中删除查询参数。 Is there any way to change the state of the application without removing the query params? 有什么方法可以在不删除查询参数的情况下更改应用程序的状态?
There is an option {location : false}
- check the doc: 有一个选项{location : false}
-检查文档:
...
Options
object. ...Options
对象。 The options are: 选项包括:
location - {boolean=true|string=}
- If true will update the url in the location bar, if false will not.location - {boolean=true|string=}
-如果为true,则将更新位置栏中的网址;如果为false,则不会更新。 If string, must be "replace", which will update url and also replace last history record. 如果为字符串,则必须为“替换”,这将更新url并替换上一个历史记录。inherit - {boolean=true}
, If true will inherit url parameters from current url.inherit - {boolean=true}
,如果为true,则将从当前url继承url参数。relative - {object=$state.$current}
, When transitioning with relative path (eg '^'), defines which state to be relative from.relative - {object=$state.$current}
,当使用相对路径(例如'^')转换时,定义相对于哪个状态。notify - {boolean=true}
, If true will broadcast $stateChangeStart and $stateChangeSuccess events.notify - {boolean=true}
,如果为true,则将广播$ stateChangeStart和$ stateChangeSuccess事件。reload
(v0.2.5) -{boolean=false}
, If true will force transition even if the state or params have not changed, aka a reload of the same state.reload
(v0.2.5)-{boolean=false}
,如果为true,则即使状态或参数未更改也将强制转换,也就是重新加载相同状态。 It differs from reloadOnSearch because you'd use this when you want to force a reload when everything is the same, including search params. 它与reloadOnSearch有所不同,因为如果要在所有条件都相同(包括搜索参数)相同的情况下强制重新加载,则可以使用它。
But I would rather keep such parameters as part of target state url
: 但是我宁愿将这些参数保留为目标状态url
一部分:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.