/
partyMap.js
61 lines (54 loc) · 1.24 KB
/
partyMap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import angular from 'angular';
import angularMeteor from 'angular-meteor';
import 'angular-simple-logger';
import 'angular-google-maps';
import template from './partyMap.html';
class PartyMap {
constructor($scope) {
'ngInject';
this.map = {
center: {
latitude: 45,
longitude: -73
},
zoom: 8,
events: {
click: (mapModel, eventName, originalEventArgs) => {
this.setLocation(originalEventArgs[0].latLng.lat(), originalEventArgs[0].latLng.lng());
$scope.$apply();
}
}
};
this.marker = {
options: {
draggable: true
},
events: {
dragend: (marker, eventName, args) => {
this.setLocation(marker.getPosition().lat(), marker.getPosition().lng());
$scope.$apply();
}
}
};
}
setLocation(latitude, longitude) {
this.location = {
latitude,
longitude
};
}
}
const name = 'partyMap';
// create a module
export default angular.module(name, [
angularMeteor,
'nemLogging', // https://github.com/angular-ui/angular-google-maps/issues/1633
'uiGmapgoogle-maps'
]).component(name, {
template,
controllerAs: name,
bindings: {
location: '='
},
controller: PartyMap
});