- AngularJS : 1.2.23
- Bootstrap : 3.2.0
- Google Maps for AngularJS : 1.2.1
- include file angular.min.js, lodash.underscore.min.js, angular-google-maps.min.js, ui-bootstrap-tpls-0.11.0.min.js
Photos clicked
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&key=xxxxxxxxxxxxxxxxxx&sensor=false&libraries=panoramio"></script> <script type='text/javascript' src='http://www.example.com/wp/wp-content/themes/ang/js/lodash.underscore.min.js'></script> <script type='text/javascript' src='http://www.example.com/wp/wp-content/themes/ang/js/angular-google-maps.min.js'></script> <script type='text/javascript' src='http://www.example.com/wp/wp-content/themes/ang/js/app.js'></script> <div ng-controller="MyCtrl"> <div class="row"> <div class="col-sm-12"> <google-map id="map-canvas" center="map.center" zoom="map.zoom" draggable="true" options="map.options" control="map.control" events="map.events" > </google-map> </div> <div class="panel panel-default {{show}" id="photo-panel" style="width: 300px;max-height:300px;overflow-y: auto;"> <div class="panel-heading">Photos clicked</div> <div class="panel-body"> <ol> <li ng-repeat="list in LinkDisplay"> <a href="{{list.url}">{{list.title}:{{list.author}</a> </li> </ol> </div> </div> </div> </div>
var mapApp = angular.module('googleMapApp', ['google-maps','ui.bootstrap']); mapApp.controller("MyCtrl", function ($scope) { angular.extend($scope, { map: { center: { latitude: 35.681382, longitude: 139.766084 }, options: { maxZoom: 20, minZoom: 3 }, zoom: 15, control: {}, events: { projection_changed: function (map, eventName, originalEventArgs) { var panoramioLayer = new google.maps.panoramio.PanoramioLayer(); panoramioLayer.setMap(map); google.maps.event.addListener(panoramioLayer, 'click', function(photo) { PhotoLinkDisplay(photo); }); var photoPanel = document.getElementById('photo-panel'); map.controls[google.maps.ControlPosition.RIGHT_TOP].push(photoPanel); } } }, LinkDisplay: [], show: 'hidden' }); var lists = []; function PhotoLinkDisplay(photo) { lists.push({ title: photo.featureDetails.title, author: photo.featureDetails.author, url: photo.featureDetails.url }); $scope.LinkDisplay = lists; $scope.show = 'show'; $scope.$apply(); } });