Home  >  Q&A  >  body text

angular.js - $scope.$on不起效果

$scope.$on('$stateChangeSuccess', $scope.doRefresh);

这个函数不起效果,我计划想进入当前页面自动刷新,但是只有第一次点击进入页面才可以执行这个函数,再次点击就不进入了,求解。
PHP中文网PHP中文网2714 days ago485

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-05-15 17:14:38

    I found a solution, I even tried setting
    <ion-view title="XXX" cache-view="false"> here to no avail

    It only works if the cache is set to false in the route:

    .state('receipt', {
                    url: '/receipt',
                    cache:'false',
                    templateUrl: 'areas/receipt/receipt.html',
                    controller: "ReceiptCtrl"
                })
                
                这样就可以解决了

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-15 17:14:38

    Inject $rootScope and use $rootScope to monitor

    reply
    0
  • Cancelreply