This repository was archived by the owner on Nov 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
This repository was archived by the owner on Nov 30, 2018. It is now read-only.
Error displayed when initializing windows #489
Copy link
Copy link
Closed
Description
I get the following error when initializing windows inside of marers:
TypeError: Cannot set property 'showKey' of undefined
at http://localhost:8000/scripts/application.min.js?196e39dc464dcfafda3304be53bb6cfc:9166:47
at Array.forEach (native)
at Function._.each._.forEach (http://localhost:8000/scripts/application.min.js?196e39dc464dcfafda3304be53bb6cfc:7264:65)
at new WindowsParentModel (http://localhost:8000/scripts/application.min.js?196e39dc464dcfafda3304be53bb6cfc:9165:19)
at Windows.link (http://localhost:8000/scripts/application.min.js?196e39dc464dcfafda3304be53bb6cfc:9751:24)
at Windows.<anonymous> (http://localhost:8000/scripts/application.min.js?196e39dc464dcfafda3304be53bb6cfc:9728:23)
at http://localhost:8000/scripts/application.min.js?196e39dc464dcfafda3304be53bb6cfc:9384:23
at http://localhost:8000/scripts/application.min.js?196e39dc464dcfafda3304be53bb6cfc:1308:30
at J (http://localhost:8000/scripts/application.min.js?196e39dc464dcfafda3304be53bb6cfc:1140:35)
at f (http://localhost:8000/scripts/application.min.js?196e39dc464dcfafda3304be53bb6cfc:1000:113) <span class="angular-google-maps-windows ng-scope ng-isolate-scope" ng-transclude="" idkey="'CafeId'" coords="'Location'" show="'showWindow'" templateurl="'templateUrl'" closeclick="'onWindowClosed'" options="mapStyle.cafeInfoBoxOptions">
My HTML is
<google-map center="map.center" pan="true" control="map.mapControl"
zoom="map.zoom" draggable="true" options="options" events="events">
<marker ng-if="userLocation" icon="mapStyle.userMarkerIcon" coords="userLocation"></marker>
<markers models="cafes" idkey="'CafeId'" coords="'Location'" icon="'Icon'"
click="'onMarkerClicked'" options="mapStyle.markerOptions">
<windows idkey="'CafeId'" coords="'Location'" show="'showWindow'"
templateUrl="'templateUrl'" closeClick="'onWindowClosed'"
options="mapStyle.cafeInfoBoxOptions">
<b></b>
</markers>
</google-map>
The problem appears to be that the @ is translated to "this" instead of "_this".
src/coffee/directives/api/models/parent/windows-parent-model.coffee:18
_.each @scopePropNames, (name) ->
@[name + 'Key'] = undefined
which gets compiled to (dist/angular-google-maps.js:2951):
_.each(this.scopePropNames, function(name) {
return this[name + 'Key'] = void 0;
});
This doesn't work because "this" is undefined (according to http://underscorejs.org/#each) since not context is passed in.
It should be:
_.each(this.scopePropNames, function(name) {
return self[name + 'Key'] = void 0;
});
You can fix it by replacing it with:
_.each @scopePropNames, (name) ->
self[name + 'Key'] = undefined
A similar problem exists in src/coffee/directives/api/models/parent/polylines-parent-model.coffee:26:
Metadata
Metadata
Assignees
Labels
No labels