I have an application where I am trying to implement google maps on angular app to show where the coordinates are on the map when the user selects a place. When I try to load this app i get the error. The HTML works fine but google map does not show on my app. It can be viewed on:
http://creative.coventry.ac.uk/~4078078/Map/
gMarker.key undefined and it is REQUIRED!!
Below is the code: HTML:
<script src="http://maps.googleapis.com/maps/api/js?libraries=weather,geometry,visualization&sensor=false&language=en&v=3.14"></script>
<script data-require="angular.js@1.2.x" src="http://code.angularjs.org/1.2.16/angular.js" data-semver="1.2.16"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.underscore.min.js"></script>
<script src="http://rawgithub.com/angular-ui/angular-google-maps/master/dist/angular-google-maps.js"></script>
<script src="controllers.js"></script>
</head>
<body ng-controller="mainCtrl">
<select ng-model="selectedCoordinate" ng-options="coordinate.caption for coordinate in coordinates">
</select>
<label>zoom</label>
<input type="number" ng-model="zoom"/>
<div id="map_canvas">
<google-map center="selectedCoordinate" zoom="zoom" draggable="true" options="options">
<marker coords="selectedCoordinate"></marker>
</google-map>
</div>
I have provided head files as there have been errors due to the files before. How can I resolve this error?
I believe you're missing the idkey
parameter on your marker
directive.
<div id="map_canvas">
<google-map center="selectedCoordinate" zoom="zoom" draggable="true" options="options">
<marker idkey="{expression}" coords="selectedCoordinate"></marker>
</gooogle-map>
</div>
This is new in version 1.2.0. You can read more about here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.