【问题标题】:$state.go is not loading all the functions in my js$state.go 没有加载我的 js 中的所有函数
【发布时间】:2017-10-28 17:07:14
【问题描述】:

我正在尝试使用 state.go 重定向到另一个 url

$state.go("description-page", {disease: 'Thyroid'});

我什至没有在页面上滚动。但是当我刷新它时,它可以工作。有人可以帮忙吗? 谢谢。

【问题讨论】:

  • 提供更多代码或插件。
  • @SaiUniqui,我无法粘贴代码,因为它大约有 500 行,我怀疑 $state.go() 会和 ui-sref 做同样的事情吗?
  • 是的。它做同样的工作。
  • 其实和你的状态无关,在这里插入你的代码告诉我们你在哪里加载ui-view
  • 不相关,因为当您路由到该状态时,页面中的某些元素不会检测到路由,并且在刷新(F5)后所有元素都会准备好。

标签: angularjs angularjs-directive angularjs-service angularjs-routing


【解决方案1】:

通过设置超时来解决,

$timeout({
   $state.go("description-page", {disease: 'Thyroid'});
},1000)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-03
    • 2017-08-14
    • 1970-01-01
    相关资源
    最近更新 更多