allenhwkim / angularjs-google-maps

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

InvalidValueError: not an Array #779

Closed thim81 closed 7 years ago

thim81 commented 7 years ago

Current behavior The map works as expected and shows all markers and polylines but the following error is shown:

InvalidValueError: not an Array
_.qb @ maps.google.com/maps/api/js?callback=lazyLoadCallback:38

Expected/desired behavior

No error warnings

Extra info

Version: "ngmap": "^1.18.4",

Implementation example:

<div map-lazy-load="https://maps.google.com/maps/api/js">
  <ng-map center="[51.210016, 4.389103]" zoom="11" zoom-to-include-markers="auto" map-type-control="false"  style="height:400px;">
    <!--<bicycling-layer></bicycling-layer>-->
    <marker ng-repeat="marker in map.positions"
            id="{{marker.id}}"
            position="{{marker.LatLng}}" icon="{{marker.icon}}" title="{{marker.title}}"
            on-click="showDetail(marker)">
    </marker>
    <info-window id="position-detail">
      <div ng-non-bindable="">
        Type: <b>{{map.marker.id | uppercase}}</b><br/>
        Name: <b>{{map.marker.title}}</b><br/>
        Timestamp: <b>{{map.marker.modified * 1000 | date:"dd/MM/yyyy HH:mm"}}</b><br/>
      </div>
    </info-window>

    <shape name="polyline" id="route"
           path="{{ map.route}}"
           geodesic="true"
           stroke-color="#00C477"
           stroke-opacity="1.0"
           stroke-weight="5"></shape>
  </ng-map>
</div>
thim81 commented 7 years ago

Additional:

It's linked to the

<shape name="polyline" id="route" path="{{ map.route}}" geodesic="true" stroke-color="#00C477" stroke-opacity="1.0" stroke-weight="5"></shape>

Because if I leave this out, then the error is not present anymore

allenhwkim commented 7 years ago

Please create a plunker example so that we can actually see the error

allenhwkim commented 7 years ago

Closing for inactivity

jullierme commented 7 years ago

Hi @allenhwkim

This error happens when the initial path is clean like vm.path = [];

Look: https://plnkr.co/edit/jywN60PdsLegZNTbDTSd?p=preview

This plnkr is based on: https://ngmap.github.io/#/!polyline-complex.html

Thank you, your job is very good!

allenhwkim commented 7 years ago

please use ng-if to avoid errors

    <shape ng-if="vm.path.length"name="polyline" id="foo"
      path="{{vm.path}}"
      stroke-color="#FF0000"
      stroke-opacity="1.0"
      stroke-weight="3">
    </shape>
VaishaliRavindran commented 6 years ago

I am getting that error even after using ng-if.

 <shape ng-if="selected.runner && path.length >0" 
   name="polyline" 
   path="{{path}}" 
   geodesic="true" 
   stroke-color="#5B2C6F" 
   stroke-opacity="1.0" 
   stroke-weight="2">
</shape>