angular-google-places-autocomplete icon indicating copy to clipboard operation
angular-google-places-autocomplete copied to clipboard

Cleanup drawer element when gPlacesAutocomplete $destroy occurs

Open tdakhla opened this issue 9 years ago • 1 comments

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();
    });
}

tdakhla avatar Jul 13 '15 18:07 tdakhla

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

joshleeb avatar Jul 17 '15 01:07 joshleeb