Javascript 如何在 ui-sref 标记中放置重新加载选项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27690834/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 00:30:56  来源:igfitidea点击:

How to put reload option in ui-sref markup

javascriptangularjsionic-frameworkangular-ui-router

提问by MonkeyBonkey

How can I specify the reloadoption in a ui-srefmarkup? All the examples I see use the javascript function directly.

如何reloadui-sref标记中指定选项?我看到的所有示例都直接使用了 javascript 函数。

<a ui-sref="app.editPost({new:true}, {reload:true})">new post</a>

Doesn't seem to work. Do I have to create a scope controller function to wrap that reloadoption instead?

似乎不起作用。我是否必须创建一个范围控制器函数来包装该reload选项?

I've also tried some answers below and it doesn't seem to work with the Ionic framework. Link to code pen sample below:

我也在下面尝试了一些答案,但它似乎不适用于 Ionic 框架。链接到下面的代码笔示例:

http://codepen.io/anon/pen/LERqeb

http://codepen.io/anon/pen/LERqeb

回答by Shashank Agrawal

Use ui-sref-opts. Here you go:

使用ui-sref-opts. 干得好:

<a ui-sref="app.editPost({new:true})"
   ui-sref-opts="{reload: true, notify: true}">new post</a>

https://ui-router.github.io/ng1/docs/0.3.1/index.html#/api/ui.router.state.directive:ui-sref

https://ui-router.github.io/ng1/docs/0.3.1/index.html#/api/ui.router.state.directive:ui-sref