sebholstein / angular-google-maps

Angular 2+ Google Maps Components
https://angular-maps.com/
MIT License
2.03k stars 817 forks source link

Snazzy Info Window created outside Zone. #1589

Closed MikalaiR closed 5 years ago

MikalaiR commented 5 years ago

Issue description Snazzy Info Window created outside ng zone. Because of that, [routerLink] on this window generates Navigation triggered outside Angular zone error.

Steps to reproduce and a minimal demo of the problem Somehow stackblitz fails when i import AgmSnazzyInfoWindowModule and AgmJsMarkerClustererModule. I'll just provide code snippet.

<agm-map [latitude]="53.9000000" [longitude]="27.5666700" [zoom]="6" [styles]="styles" [streetViewControl]="false">
  <agm-marker-cluster
    imagePath="https://raw.githubusercontent.com/googlemaps/v3-utility-library/master/markerclustererplus/images/m">
    <agm-marker *ngFor="let object of objects"
                [latitude]="object.location.coordinates[1]"
                [longitude]="object.location.coordinates[0]"
                [iconUrl]="iconUrl"
    >
      <agm-snazzy-info-window [closeWhenOthersOpen]="true" [showCloseButton]="false"
                              [maxHeight]="600" [maxWidth]="600">
        <ng-template>
          <div class="card si-card">
            <div class="card-footer">
              <a [routerLink]='[object.link]' class="btn btn-primary btn-sm">More</a>
            </div>
          </div>
        </ng-template>
      </agm-snazzy-info-window>
    </agm-marker>
  </agm-marker-cluster>
</agm-map>

Current behavior Angular generates Navigation triggered outside Angular zone error.

Expected/desired behavior It shouldn't.

angular2 & angular-google-maps version @agm/core@1.0.0-beta.5 @agm/js-marker-clusterer@1.0.0-beta.5 @agm/snazzy-info-window@1.0.0-beta.5 @angular/core@7.2.2

Other information I think, these callbacks must be wrapped into ngZone.run. As a workground i wrapped whole _createViewContent into ngZone.run and it works as expected.

stale[bot] commented 5 years ago

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.

stale[bot] commented 5 years ago

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.