AngularJS Google Maps example
HTML
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<div ng-app="myApp">
<div ng-controller="MapCtrl" ng-init="find()">
<div id="map-canvas"></div>
<select id="type" onchange="filterMarkers(this.value);">
<option value="">Please select category</option>
<option value="computer science">computer science</option>
<option value="electronic system">electronic system</option>
<option value="communication thoery">communication thoery</option>
<option value="english">english</option>
<option value="optical&fiber optics">optical&fiber optics</option>
<option value="Digital Electronics">Digital Electronics</option>
<option value="signal&systems">signal&systems</option>
</select>
</div>
</div
CSS
#map-canvas {
width: 500px;
height: 500px;
}
JavaScript
angular.module('myApp', [])
.controller('MapCtrl', [
'$scope', '$http', '$compile',
function ($scope, $http, $compile) {
//-------------------------------------------------------------------------------------------------------------------------------------------------
$scope.find = function () {
var gmarkers1 = [];
var markers1 = [];
var infowindow = new google.maps.InfoWindow({
content: ''
});
// Our markers
markers1 = [
['0', 'Madivala', 12.914494, 77.560381, 'computer science,electronic system,communication thoery,english', 'as12', 'Abi Tech ACC','http://static4.wikia.nocookie.net/__cb20131121214007/destinypedia/images/7/71/Information_Icon.svg'],
['1', 'Majestic', 12.961229, 77.559281, 'electronic system,Telecommunication,optical&fiber optics', 'as13', 'Vell Infotech','http://icons.iconarchive.com/icons/kyo-tux/aeon/256/Sign-LogOff-icon.png'],
['2', 'Ecity', 12.92489905, 77.56070772, 'communication thoery,english,Digital Electronics,signal&systems', 'as14', 'vinoth coching center','http://icons.iconarchive.com/icons/artua/mac/512/Intranet-icon.png'],
['3', 'Jp nagar', 12.91660662, 77.52047465, 'Digital Electronics,signal&systems', 'as15', 'Gpy tech archi','http://www.psdgraphics.com/file/upload-icon.jpg']
];
/**
* Function to init map
*/
function initialize() {
var center = new google.maps.LatLng(12.9667, 77.5667);
var mapOptions = {
zoom: 12,
center: center,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
for (i = 0; i < markers1.length; i++) {
addMarker(markers1[i]);
}
}
/**
* Function to add marker to map
*/
function addMarker(marker) {
...