重新加载:true 只工作一次 [英] reload: true works only once

查看:34
本文介绍了重新加载:true 只工作一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的 anulgar/ionic 应用程序中将参数从一个视图传递到另一个视图.

I am trying to pass parameters from one view to another in my anulgar/ionic app.

volCompute 视图中(声明了 $stateParams):

in the volCompute view ($stateParams is declared):

if ($stateParams.modelLine){
    console.log('receiving', $stateParams.modelLine.id, $stateParams.modelLine.modelStrict)
    $scope.data.chosenModel = $stateParams.modelLine.modelStrict;
}

compare 视图中:

$state.go('app.volCompute', { modelLine: test[0] }, {reload: true});

但它只工作一次,如果我在两个视图之间来回切换,volCompute 中的代码不会运行.似乎 reload: true 只执行一次.

but it works only one time, if I go back and forth between the two views the code in volCompute is not run. It seems like the reload: true is only executed once.

你能帮忙吗?

推荐答案

关于如何理解离子缓存的更多细节

There are few more details how to understand ionic caches

我建议在这里使用事件钩子 $ionicView.enter$ionicView.afterEnter

And I would suggest to use the event hook here $ionicView.enter or $ionicView.afterEnter

$scope.$on('$ionicView.enter', function(){
  // Coding
});

文档链接

这篇关于重新加载:true 只工作一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆