Issue 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
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>
@AncaorDev: Great workaround, I'll give it a try! (later the same day: Worked! Thanks!)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Worked well - thank you
Hey @RogerBrad and others,, this issue was tracked in #1681 and fixed in #1683. Workarounds should no longer be needed. Make sure to use the latest agm version 1.0.0-beta.7
I have error like Can't bind to 'animation' since it isn't a known property of 'agm-map'. please help me
for this error, which package do I import in app.modual.ts
you import AgmCoreModule. Also, make sure to use the latest version of AGM
Most helpful comment
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>