angular-ui / angular-google-maps

AngularJS directives for the Google Maps Javascript API
http://angular-ui.github.io/angular-google-maps
2.52k stars 1.07k forks source link

Icons do not work with polyline/polylines. #1010

Closed dmackerman closed 9 years ago

dmackerman commented 9 years ago

Thanks for this great directive. One issue I'm having!

I start by initializing my polylines like this, with an empty path[]:

vm.polylines = [{
    id: 1,
    path: [],
    icons: [{
        icon: {
            path: google.maps.SymbolPath.BACKWARD_OPEN_ARROW
        },
        offset: '25px',
        repeat: '50px'
    }],
    stroke: {
        color: '#7A58BD',
        weight: 5
    },
    editable: true,
    draggable: true,
    geodesic: false,
    visible: true
}];

I then push my polylines into path when the Google API is ready and the lines render. However, the icons do not render at all.

It seems that you're trying to use icons in this example, and they're broken also. https://angular-ui.github.io/angular-google-maps/#!/api

Is there a version of the library where this was working, before 2.0?

nmccready commented 9 years ago

Are you making sure google.maps.SymbolPath.BACKWARD_OPEN_ARROW is defined when you use it initially? I would recommend not trying this until the Api is loaded.

nmccready commented 9 years ago

If you notice nothing on polylines in the example is set until after the API is ready.

https://github.com/angular-ui/angular-google-maps/blob/master/example/assets/scripts/controllers/example.js#L34-L74

nmccready commented 9 years ago

Also Icons work there.

dmackerman commented 9 years ago

Appreciate the response. I am infact doing all of the polyline stuff inside of the uiGmapGoogleMapApi.then(function(maps) { ... }, which should indicate that the API is indeed ready. Here's a console.log of my polylines object vm.polylines and you'll see that the icons object gets replaced properly.

https://www.dropbox.com/s/klpgy063a95lwoz/Screenshot%202014-12-15%2009.11.32.png?dl=0

Also, I still don't see the icons working here: https://angular-ui.github.io/angular-google-maps/#!/api

arturopuente commented 9 years ago

Hello, I'm also having issues with this feature (I'm using the master branch), I've checked the Plunker example and it doesn't show the icons either. Thanks a lot for your time!

dmackerman commented 9 years ago

@nmccready: Not sure what your opinion is, but the examples are broken as well. That to me means the feature is broken. I'd try to fix it myself, but coffeescript is really hard for me to grok without a lot of time spent analyzing it.

nmccready commented 9 years ago

You mean the website examples? Yeah they are probably broke. I'll get to it. The code is solid the docs are behind. I'll try and get to it as I only have so much time.