jasper07 / openui5-googlemaps

Openui5 Googlemaps library
MIT License
65 stars 43 forks source link

setMap() throws error: "InvalidValueError: setMap: not an instance of Map; and not an instance of StreetViewPanorama" #23

Closed Prateek057 closed 7 years ago

Prateek057 commented 7 years ago

@jasper07 : I am unable to setMap for new Marker, could you please tell me why ?

My Map is as below var oMap = new openui5.googlemaps.Map(mapId, { lat: oPos.lat, lng: oPos.lng, height: ($(document).height()) * 0.9 + "px", zoom: 10, markers: { path: "/stations", template: oMarkers } }); my Marker template is as Below var oMarkers = new openui5.googlemaps.Marker({ lat: '{lat}', lng: '{lng}', info: '{info}', icon: '{icon}', click: onMarkerClick });

my new marker is as below var currentLocationMarker = new openui5.googlemaps.Marker({ info: "Current Location", lat: oPos.lat, lng: oPos.lng, icon: "resources/img/current_work.png" });

and I trying to set the Marker to the above map like this currentLocationMarker.setMap(oMap); currentLocationMarker.setMarker();

However I am getting this error in the console Could please tell me why this issue is occuring "InvalidValueError: setMap: not an instance of Map; and not an instance of StreetViewPanorama", I am fairly new to this hence any advise will be helpful.

Thanks, Prateek

jasper07 commented 7 years ago

Hi Prateek

This is a Question and not an issue, I would ask it on StackOverflow first.

My guess is you are mixing up binding and non binding data. Try pushing a new entry to "stations".

Hth JSP