Open leandroz opened 9 years ago
Hey Leandro, first of all, thank you! It's always a pleasure to see that someone out there is using this.
What kind of features are you thinking of? I'm definitely interested in improving this directive, but curious to hear your suggestions!
I think that in first place it would be great to have access to the entire location object outside the readonly input. For example in my case, the user select a location, and then i need the geometry data for that particularly result to be available in the controller scope. Maybe adding other attribute like details is used in ngAutocomplete and bind the entire location object to that attribute. Maybe is better to use the directive as an attribute instead of replacing the entire object. Let me know what you think!
Well, right now you can set ng-model
and access the full object.
As for making it an attribute, could you give some real use cases? What would be some of the practical use cases for the change? I'm not sure I completely understand what you have in mind.
It was my mistake, for some reasons the binding to the ng-model was not working but now yes, so i can access to the entire location object perfectly. I think that to be more flexible would be great to:
I thing that with these three features the directive will be awesome.
Hey @leandroz - could you share code on how you're accessing the model object. I, too, am coming from ngAutocomplete, and having trouble triggering a callback from a $watch on the ng-model object in my controller. Perhaps $watch might not be the best way to checking for updated location?
Thanks @israelidanny - I'm really liking this. I notice that I get very different results that I do from Google Places Autocomplete. For my uses, the latter is more useful. Is there someway to get results from your directive that are more similar to what I'd normally get from Autocomplete?
@quipu i am using the ng-change directive inside the template directive:
<input type="text" readonly="readonly" class="ion-google-place" autocomplete="off" ng-change="centerOnMe()">
So when you choose a location the function is called.
@quipu - In what way are the results different? The results are straight from the Google API, and technically you should get the same exact results.
@leandroz - The region bias is actually possible to do right now. Just add region biasing to the SDK on load:
<script src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false*®ion=es*"></script>
I will however work on adding it with an option to change it dynamically (on a per request basis).
@israelidanny i get something like the following if I search for "Vulc":
Vulcan, AB, Canada
Vulcano, Lipari, Messina, Italy
Vulcania, Saint-Ours, France
Vulcan, Hunedoara County, Romania
Vulcan Way, Richmond, BC, Canada
Whereas, using Autocomplete, I get:
Vulcan Lane, Auckland, New Zealand
Vulcan Lane Cafe, Vulcan Lane, Auckland, New Zealand
Vulcan Chambers, Vulcan Lane, Auckland, New Zealand
Vulcan Steel, Neales Road, Auckland, New Zealand
Vulcan Steel, East Tamaki, Auckland, New Zealand
Looking into it, I think this is due to the API sending different results depending on what API library your using. Autocomplete uses the AutocompleteService from the Places library (https://developers.google.com/maps/documentation/javascript/reference#AutocompleteService) whereas I think you're using the Geocoder (https://developers.google.com/maps/documentation/javascript/reference#Geocoder).
API use is very similar so I was able to get it working for me with only a couple of minor changes.
@leandroz thanks! - ng-change working well for me.
Would you say that the results from Places are more relevant? If you feel so, I might be interested in a Pull Request for this one! It seems that it loaded things located nearby you.
On Sun, Oct 12, 2014 at 12:47 AM, quipu notifications@github.com wrote:
@israelidanny https://github.com/israelidanny i get something like the following if I search for "Vulc":
Vulcan, AB, Canada Vulcano, Lipari, Messina, Italy Vulcania, Saint-Ours, France Vulcan, Hunedoara County, Romania Vulcan Way, Richmond, BC, Canada
Whereas, using Autocomplete, I get:
Vulcan Lane, Auckland, New Zealand Vulcan Lane Cafe, Vulcan Lane, Auckland, New Zealand Vulcan Chambers, Vulcan Lane, Auckland, New Zealand Vulcan Steel, Neales Road, Auckland, New Zealand Vulcan Steel, East Tamaki, Auckland, New Zealand
Looking into it, I think this is due to the API sending different results depending on what API library your using. Autocomplete uses the AutocompleteService from the Places library ( https://developers.google.com/maps/documentation/javascript/reference#AutocompleteService) whereas I think you're using the Geocoder ( https://developers.google.com/maps/documentation/javascript/reference#Geocoder ).
API use is very similar so I was able to get it working for me with only a couple of minor changes.
@leandroz https://github.com/leandroz thanks! - ng-change working well for me.
— Reply to this email directly or view it on GitHub https://github.com/israelidanny/ion-google-place/issues/3#issuecomment-58765704 .
For the project I'm working on, yes - the audience will generally be searching for locations that are within proximity to their current location. I think introducing the flexibility to configure the API used could be really useful. I'd be happy to work through it and submit a PR.
That would be great! I'd merge that!
On Sun, Oct 12, 2014 at 1:00 AM, quipu notifications@github.com wrote:
For the project I'm working on, yes - the audience will generally be searching for locations that are within proximity to their current location. I think introducing the flexibility to configure the API used could be really useful. I'd be happy to work through it and submit a PR.
— Reply to this email directly or view it on GitHub https://github.com/israelidanny/ion-google-place/issues/3#issuecomment-58766102 .
How about a more generic version and call it ion-autocomplete or such that works with a multitude of data (resources, promises, data arrays). I am sure you would increase your fan base quite a bit ;-)
That's an interesting idea! Melikes! Stay tuned in the following days
On Thu, Oct 16, 2014 at 12:11 AM, svenwoldt notifications@github.com wrote:
How about a more generic version and call it ion-autocomplete or such that works with a multitude of data (resources, promises, data arrays). I am sure you would increase your fan base quite a bit ;-)
— Reply to this email directly or view it on GitHub https://github.com/israelidanny/ion-google-place/issues/3#issuecomment-59277147 .
I would definitly be interested in a version using the Google Places API. The results are more relevant to me.
@quipu - are you intrested in sharing your changes as a more generic PR?
@israelidanny @Positivex keen to contribute as this is working awesomely for me. I'll try and get something together in the next few days but in the meantime here are my changes to work with Google Places - https://www.diffchecker.com/81x24fiy
I'm also wondering if it would be better for some to adopt an external template - this is something I'll need to do for my use, and possibly a common customization requirement.
Thanks @quipu ! I implemented your changes and it works like a charm. @israelidanny I created a PR so you can see the changes.
Hey, all the diff in your PR is absolutely lit up because of differences in tabs. Care to show me where you made the changes?
I'm thinking about the ability to make it support both backends.
Hi Danny. I'll think that would be a great idea. I'll put together some details later today/overnight. FWIW, I've adapted this directive for a number of search uses that hit an API - there might be a way to make it more modular using external templates and API call sub-modules.
I think it would be a great improvement to have this directive use the google "places" https://developers.google.com/maps/documentation/javascript/places-autocomplete library, instead of the Geocoding API. The main difference, it looks like, from what I can tell, the ion-google-place directive seems to only work with Addresses, by switching over to "places" it would work with both addresses and locations, like the names of businesses.
Hey @matt-ward - @Positivex and I have a couple of open PRs you can look at to get going with the Places service.
Did we ever get the NgAutocomplete integrated into this? Please advise.
Hi I wan to use NgAutocomplete with google places. I can see that https://www.diffchecker.com/81x24fiy is expired now. Can anyone please share the difference/ or the code snippet. Thanks
Hey @manojbsw - https://github.com/israelidanny/ion-google-place/pull/5/files pretty much covers it.
Hi Danny!, great work with this directive!
I am using ngAutocomplete (https://github.com/wpalahnuk/ngAutocomplete) in other project and i think that could be great to implement the same features in this directive!
Let me know if you are interested, i could help you if you want!
Congrats!