Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$destroy event for controller $scope not getting fired #231

Open
asgeo1 opened this issue Nov 26, 2013 · 0 comments
Open

$destroy event for controller $scope not getting fired #231

asgeo1 opened this issue Nov 26, 2013 · 0 comments

Comments

@asgeo1
Copy link

asgeo1 commented Nov 26, 2013

Hi @tbosch,

When does the $scope for a jqm page get destroyed?

I'm doing something like this in my controller:

var tagRead = function(event) {
  $scope.$apply(function(){
    $scope.searchPlantId = event.tag;
  });
}

$window.addEventListener('tagread', tagRead, false);

$scope.$on('$destroy', function() {
  $window.removeEventListener('tagread', tagRead);
});

In normal AngularJS, when I navigate to a new page, the ng-view directive will ensure that the $scope for the previous view/controller is cleaned up, i.e. by firing the $destroy event.

With jqm-angular-adapter, that does not seem to be the case, and $destroy is never fired when navigating to a new page.

Any reason why? I'm not really understanding what's going on here with jqm-angular-adapter.

Cheers,
-adam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant