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

Cleanup drawer element when gPlacesAutocomplete $destroy occurs #41

Open
tdakhla opened this issue Jul 13, 2015 · 1 comment
Open

Cleanup drawer element when gPlacesAutocomplete $destroy occurs #41

tdakhla opened this issue Jul 13, 2015 · 1 comment

Comments

@tdakhla
Copy link

tdakhla commented Jul 13, 2015

Inside the gPlacesAutocomplete init code, the drawer element is appended to body: https://github.com/kuhnza/angular-google-places-autocomplete/blob/master/src/autocomplete.js#L88

However, upon $destroy of the gPlacesAutocomplete element, there should be cleanup logic to remove that element from <body> via element.remove().

The code should be updated as such:

function initAutocompleteDrawer() {
    // existing code...

    scope.$on('$destroy', function() {
        $drawer.remove();
    });
}
@joshleeb
Copy link
Contributor

scope needs to be $scope then +1 confirm this fixes #42

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

2 participants