blob: f8361dea29a2e4eef4d1a130e968c3db6e05bee3 [file] [log] [blame]
/*global google: true */
(function () {
'use strict';
angular.module('mCord')
.directive('eNodeMap', function () {
return {
restrict: 'E',
scope: {},
controllerAs: 'vm',
templateUrl: 'app/view/home/e-node-map.tpl.html',
controller: function($log, Enodeb, NgMap){
let bounds = new google.maps.LatLngBounds();
Enodeb.query().$promise
.then((enodes) => {
this.selectedEnode = enodes[0];
this.enodes = enodes;
enodes.forEach(node => {
const latlng = new google.maps.LatLng(node.GpsCoordinate.Latitude, node.GpsCoordinate.Longitude);
bounds.extend(latlng);
});
return NgMap.getMap();
})
.then((map) => {
map.setCenter(bounds.getCenter());
map.fitBounds(bounds);
});
this.showEnodeDetails = (marker, enode) => {
this.selectedEnode = enode;
};
}
}
});
}());
/*global google: false */