Animations not working for map markers
See original GitHub issueIssue description When trying to add an animation to a marker with, for example,
<agm-marker [iconUrl]="{url:userMarker, anchor:{x:5, y:5}, zIndex: 100,size: {width: 10, height: 10}}" [latitude]="latitude" [longitude]="longitude" [animation]="'BOUNCE'"></agm-marker>
it throws the following error:
console.js:35 ReferenceError: google is not defined at MarkerManager.push../node_modules/@agm/core/services/managers/marker-manager.js.MarkerManager.addMarker (marker-manager.js:73)
it looks like the variable google
is not defined in the scope of the marker-manager.js
file.
Steps to reproduce and a minimal demo of the problem Just try adding any animation to a marker.
Current behavior Throws error in console log, marker still displayed.
Expected/desired behavior Marker both displayed and animated.
angular2 & angular-google-maps version @agm/core": “^1.0.0-beta.3 @angular/core”: "^6.0.3
Issue Analytics
- State:
- Created 5 years ago
- Comments:7
Top GitHub Comments
I had the same problem and it was initialized before I loaded the component agm-map What I did was initialize an indefinite variable and then output mapReady give value to that variable.
— map.component.ts myAnimation:any; mapReading(){ myAnimation = ‘BOUNCE’; } — HTML
<agm-map (mapReady)="mapReading()"> <agm-marker [iconUrl]="[animation]="myAnimation"></agm-marker> </agm-map>
you import
AgmCoreModule
. Also, make sure to use the latest version of AGM