如何在ui-sref标记中添加重载选项

Mon*_*key 27 javascript angularjs angular-ui-router ionic-framework

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

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

似乎没有用.我是否必须创建一个范围控制器函数来包装该reload选项?

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

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

Sha*_*wal 67

干得好:

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

http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.directive:ui-sref

  • 嘿@MonkeyBonkey,在你的问题上花了半个小时后,我开始通过实施来解决这个问题.离子缓存状态并且不会破坏范围但只是断开连接.如此简单的修复问题就是在状态配置中使用`cache:false`.干杯! (11认同)
  • 如果您使用的是版本<0.2.11,请在重新加载选项中添加`notify:true`.我在答案上修改了相同的内容. (2认同)