agm-circle Cannot read property 'then' of undefined at Observable.subscribe

1.2k Views Asked by At

Good afternoon, I am new to angular 8 and AGM maps, I am trying to generate a circle on the map but when I implement it I get the following

ERROR TypeError: Cannot read property 'then' of undefined
    at Observable._subscribe (agm-core.js:292)
    at Observable._trySubscribe (Observable.js:42)
    at Observable.subscribe (Observable.js:28)
    at agm-core.js:1499
    at Map.forEach (<anonymous>)
    at AgmCircle._registerEventListeners (agm-core.js:1498)
    at AgmCircle.ngOnInit (agm-core.js:1449)
    at checkAndUpdateDirectiveInline (core.js:31910)
    at checkAndUpdateNodeInline (core.js:44367)
    at checkAndUpdateNode (core.js:44306)

my code is the following

   <mat-card-content class="text-justify ">
     <agm-map [latitude]=" contri.latitude " [longitude]=" contri.longitude " [zoom]="mapzoom ">
          <agm-circle [latitude]="40.7127753"  [longitude]="-74.0059728"                     [clickable]="false"    [draggable]="true"   [editable]="false"   [fillColor]="green"                       [fillOpacity]="0"       [radius]="175.61"> </agm-circle>

                </agm-map>
            </mat-card-content>

in the app.module.js I have the following import

 imports: [ 
    AgmCoreModule.forRoot({
      apiKey: 'AIzZZaassdqws4aaa',
      libraries: ["places", "geometry"]
    })

Someone has gotten this error or knows what it is due to

1

There are 1 best solutions below

0
On

A temporary solution is a downgrade to "@agm/core": "1.1.0"

This worked for me

The actual version is 3.0.0 beta and its a Pre Release, so this means that is not a stable version

I took the example package.json from this plunker https://stackblitz.com/edit/angular-google-maps-demo?file=app%2Fapp.component.html

Check the releases https://github.com/SebastianM/angular-google-maps/releases