angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

[Freature request] Add address picker

Open programming-kid opened this issue 12 years ago • 17 comments

@nlaplante this is amazing directive and thanks for prompt response on issues . I have a feature request , do you have plans to include address picker to this directive ?? Adding address picker to this directive will be great addition to this plug-in . Adding something like this typeahead-addresspicker will be great . Currently i am using both this plugin in my project but having something like this built in angular-google-maps will be great .

programming-kid avatar Jun 02 '14 11:06 programming-kid

There are no plans, but if you follow the api like the other directives it will get in. Please think ahead on things like.. Will I need to share this with something else (extend, reuse methods.. etc). Please follow the design where the directive is practically a shell and the logic is in the api. This makes it way easier to test.

nmccready avatar Jun 02 '14 12:06 nmccready

You will notice some directives like circle and rectangle, do not follow them as examples. Follow marker, markers, map, window, windows, polyline, layer and polylines.

nmccready avatar Jun 02 '14 12:06 nmccready

I am some what new to angular directives i am just getting hold of them so can please guide me with how do i get started with integrating address picker with this directive

programming-kid avatar Jun 02 '14 12:06 programming-kid

The best way to learn is seriously on your own. Follow the directives to api, to models utils and managers.

It might be easier to go in reverse from api to directive. Because honestly directives have the most custom / foreign syntax to the standard js world.

But basically it is this figure out what attributes you want to:

  • bind
  • watch
  • or just be attributes that are not bound
  • be functions
  • be object / vlaues

Once that is decided this is what you define as your scope. Then if you need to create references for each new address-picker via a link then you need to use a factory (creates an instance or class). If it is a singleton like object and does not need state information then use a service object.

nmccready avatar Jun 02 '14 12:06 nmccready

Use chrome debugger, unit test a ton fail and get back up. Eventually it will click and you will see it clearly.

nmccready avatar Jun 02 '14 12:06 nmccready

Angular's documentation is so-so; therefore if it does not help you search google or stackoverflow as you will find more examples written by a human (angular docs seem to be written by spock or a robot).

nmccready avatar Jun 02 '14 12:06 nmccready

Tip: There's already an angular google places autocomplete / typeahead 'address picker' module that seems pretty solid and configurable.

I use it alongside angular-google-maps. I assume it would be trivial to load up both modules and connect them to each other, although I haven't tried that, yet.

kurtmilam avatar Jun 23 '14 11:06 kurtmilam

Adding milestone so this can be dealt with.

cthrax avatar Aug 03 '14 16:08 cthrax

The search-box directive auto completes whatever you type in. If that is sufficient we can close this issue.

kandizzy avatar Nov 24 '14 14:11 kandizzy

I have no plans to work on this until I myself need it. So if someone wants this they need to dig in.

nmccready avatar Mar 11 '15 01:03 nmccready

@programming-kid would you mind posting a plunker with your map working along with the typeahead? Or pointing me out on which repo of yours you have this snippet once I tried to find but couldn't.

morettimatheus avatar Apr 21 '15 12:04 morettimatheus

@morettimatheus You can use Autocomplete by setting the search-box directive's options.autocomplete parameter to true. Here is a plunkr and there's more information and links to Google's documentation in the api docs

http://plnkr.co/edit/PIvhQQYTtE8fhzhU4lax?p=preview

kandizzy avatar Apr 21 '15 12:04 kandizzy

@kandizzy Carrie, clicking on any search suggestion won't center the map or place the icon at this suggestion point. Is this the normal behaviour? Should I just use Maps API from now on?

Thank you very much for the plunker. And for all the support :+1: :smile:

morettimatheus avatar Apr 21 '15 13:04 morettimatheus

This directive supports all of that functionality, but you need to add that to your own code. There are examples provided on how to use everything. The specific example you'll want to look at is search-box-autocomplete

Take a look at the javascript file for that example on how to add markers from the search results.

You can clone this repo and run grunt example and work on this locally- or you can add the marker code to that plunkr.

kandizzy avatar Apr 21 '15 13:04 kandizzy

Thank you very very much! This example you have shown works perfectly! Sorry for not looking through examples before commenting here.

After I finish this task I will create a plunker and paste it here so other people with the same issue can see the solution easier.

Thank you very much once again :smile:

morettimatheus avatar Apr 21 '15 14:04 morettimatheus

@morettimatheus cool! thank you :+1:

kandizzy avatar Apr 21 '15 14:04 kandizzy

I was previously using AngularGm and ngAutocomplete. I suppose my only problem with the current <ui-gmap-search-box> directive is that it requires wrapping in a <ui-gmap-google-map>, which it really shouldn't depend on.

I have something similar to what you see on AirBnb homepage, where you search for something (without a map), get the result and then redirect them to a page containing the map, using the center location.

Using the current search-box, I'll have to hide the map, but it's a waste of resources to have to create an unneeded map instance.

I'll attempt to use ngAutocomplete, but not sure how it'll play with the async loading of this library. If I fail at that, I'll try to manually integrate something into this lib. Probably not too difficult :)

intellix avatar Jul 26 '15 11:07 intellix