ion-google-place
ion-google-place copied to clipboard
Not working with Ionic 1.3.13
I am trying to get ion-google-place working with Ionic 1.3.13.
After following the README instructions I am not seeing the location popup.
I am also not getting any errors.
Any idea on how to debug this?
Did you include css to the head in index.html?
Ok now I am getting the overlay which looks great, but I am unable to click on any of the items as I type. It is dynamically updating but not allowing me to tap on an item to close the modal.
Digging into the ion-google-place
code a bit more it seems like the selectLocation
method on the popup scope is not being called.
I do have my <selectLocation> tag in a modal. I'll see if that is somehow related... perhaps a z-index issue?
Yes that seems to be the problem. When I launch the ion-google-place popup from a non-ion-modal window it works perfectly.
Any thoughts on how to address this?
Ah found the fix in another issue thread #4
Is there a reason this fix, adding the modal
class to the ion-google-place-container
, hasn't been merged?
Create a quick pull request for this if you'd like to merge it.
I struggled with getting the data out from the directive in the controller. My solution was to use a object in the ng-model
<ion-google-place placeholder="Search City, Country" ng-model="search_data.location" > </ion-google-place>
in the controller
$scope.search_data = {
location: ''
};
$scope.$watch('search_data.location', function(newVal, oldVal) {
console.log('watch', newVal, oldVal)
if (newVal.hasOwnProperty('formatted_address')) {
$scope.search_city();
}
});
this worked for me. I used $scope.apply to assign the output to a variable.