allenhwkim / angularjs-google-maps

The Simplest AngularJS Google Maps V3 Directive
http://ngmap.github.io
MIT License
1.52k stars 516 forks source link

Unable to reuse ngmap on dialog #838

Open abelbarbosa opened 7 years ago

abelbarbosa commented 7 years ago

I'm trying to setup a location chooser using a dialog (from angular material).

Something like this:

<md-dialog>
    <form name="af" layout="column" data-ng-submit="save()">
        <md-toolbar>
           <!--  -->
        </md-toolbar>
        <md-dialog-content>
            <!--  -->
            <div map-lazy-load="https://maps.google.com/maps/api/js" map-lazy-load-params="{{::googleMapsUrl}}">
                <ng-map center="{{center}}" zoom="16" on-click="setPosition()">
                    <marker ng-if="position" position="{{position.lat}}, {{position.lng}}"></marker>
                </ng-map>
            </div>
            <!--  -->

        </md-dialog-content>
        <md-dialog-actions layout="row">
            <!--  -->
        </md-dialog-actions>
    </form>
</md-dialog>

It works the first time I use the dialog. After that the map is not rendered properly.

Is this a bug or am I doing something wrong?

hadicahyadi commented 7 years ago

same issue.. still figure it out..

allenhwkim commented 7 years ago

Please look at this. https://github.com/allenhwkim/angularjs-google-maps#grey-area-in-google-maps