Skip to content
This repository has been archived by the owner on Nov 30, 2018. It is now read-only.

Allow specifying info windows and custom icons #14

Merged
merged 1 commit into from Feb 28, 2013
Merged

Allow specifying info windows and custom icons #14

merged 1 commit into from Feb 28, 2013

Conversation

manuelmeurer
Copy link
Contributor

As mentioned in #13

@ghost ghost assigned nlaplante Feb 26, 2013
@nlaplante
Copy link
Contributor

Nice work, but I have a question. Since there's only one info window opened at a time, what happens if we have 3 markers with info windows at the same time when initializing the map?

@manuelmeurer
Copy link
Contributor Author

The info window only opens when you click on the marker, so having multiple markers with info windows is no problem. If an info window is open and you click on another marker with an info window, the currently open one closes and the new one opens.

@nlaplante
Copy link
Contributor

Great. Merging!

nlaplante added a commit that referenced this pull request Feb 28, 2013
Allow specifying info windows and custom icons
@nlaplante nlaplante merged commit 977019f into angular-ui:master Feb 28, 2013
@manuelmeurer manuelmeurer deleted the info_windows_and_icons branch February 28, 2013 16:13
@cmorner
Copy link

cmorner commented Mar 6, 2013

When creating a custom marker, is this the correct way?

-- This lives in my Map Controller --
markers: [{latitude:59.338021, longitude:18.08741, label:'hejsan', infoWindowContent:'Hello', url:'SOMEURL'}];

I'm using firefox and the marker itself shows up but is not clickable, no label will show etc.

Is something not working or am I doing it wrong?

@manuelmeurer
Copy link
Contributor Author

Replace "infoWindowContent" with "infoWindow" and it should work.

("label" and "url" are not working yet, see https://github.com/nlaplante/angular-google-maps/blob/master/src/angular-google-maps.js#L195)

@heldrida
Copy link

@manuelmeurer thanks for your suggestion, it does work with "infoWindow", but I'd like to know why ? I've checked the angular-google-maps.js and only found "InfoWindowContent", so "InfoWindow" is magic and the only way I found this, was by following your suggestion. I've checked the manual and I'd like to know what I'm missing, so I don't have to relay on you guys all the time or ask silly questions. Any tips is appreciated, thanks for your time!

***** After a couple of minutes I understood why, after reading your pull request *****

So, the reason is here:

        angular.forEach(newValue, function (v, i) {
          if (!_m.hasMarker(v.latitude, v.longitude)) {
            _m.addMarker(v.latitude, v.longitude, v.icon, v.infoWindow);
          }
        });

the object key is "infoWindow". I just wonder if it isn't better to rename this to InfoWindowContent ? In the moment it doesn't make any difference to me, but my first assumption was InfoWindowContent, instead of InfoWindow that I only found out by reading your comment, or would take me more time to find it in the code.

Thanks for your time!

@manuelmeurer
Copy link
Contributor Author

Well, infoWindowContent is just used internally as the name of the passed parameter AFAICS. I didn't use infoWindow there since I named the variable that holds the actual info window like that.
Instead of renaming that I would recommend adding move examples or docs that describe exactly how this directive is used.

@heldrida
Copy link

@manuelmeurer thanks for your time! You're right docs describing what to do would be much better.

@leeeandroo
Copy link

How can I use a Custom Info Window to apply my layout? There are a way to do this?

@nmccready
Copy link
Contributor

Guys the best thing to do right now is to look here #83

Go down and look where 'epiphany' is stated. That area is how to use InfoWindows most efficiently. If your using

Windows then your html content will only be updated when the entire models array is changed. Again if you use Windows... all the InfoWindows are being put into memory even if they are not being viewed. Therefore that is how the idea of tracking activeMarkers came about. Read that thread as there is good stuff there.

We will get to the documentation asap.. but right now I am slammed with work.

@grantmx
Copy link

grantmx commented Nov 21, 2013

Can any one give a tip on adding a custom label using this directive? I tried to add one via the marker object to no avail.

var marker = new google.maps.Marker({
              position: new google.maps.LatLng(lat, lng),
              map: _instance,
              icon: icon,
              labelContent: "A",
              labelClass: "labels", // the CSS class for the label
              labelInBackground: false
        });

I did it this way just to see if it would at least add "A" to all of them. Was then going to change the that.markers.unshift() instance, so I can create custom ones for each in the array.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants