且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在不重新加载 ui 视图的情况下更新 $stateParams?角度ui路由器

更新时间:2023-09-21 15:13:52

您可以使用以下内容转到特定路线而无需重新加载视图:

You could use the following to go to a specific route without reloading the views:

$state.go('.', {parm1: 1}, {notify: false});

最后一个对象字面量表示您可以传递给 go 的选项.如果将 notify 设置为 false,这实际上会阻止控制器重新初始化.开头的.是你想去的绝对状态名或相对状态路径.

The last object literal represents the options which you can pass along to go. If you set notify to false, this will actually prevent the controllers from being reinitialized. The . at the beginning is the absolute state name or relative state path you wanna go to.

重要的是 notify.