I’m trying to develop an app using angularjs and a directive that I’ve found for instantiate GMaps: http://nlaplante.github.io/angular-google-maps/#!/usage. I follow all the steps but I cant get to render the map! it returns no errors!
in the HTML
JavaScript
x
2
1
<html ng-app="Maptesting">
2
JavaScript
1
2
1
<div ng-view></div>
2
JavaScript
1
3
1
<script src="app/map.js">
2
</script>
3
In the controller:
JavaScript
1
13
13
1
angular.module('Maptesting', ['google-maps'])
2
3
.controller('CtrlGMap', ['$scope', function($scope) {
4
$scope.center = {
5
latitude: 45,
6
longitude: -73
7
};
8
9
$scope.markers = [];
10
$scope.zoom = 8;
11
12
}])
13
Advertisement
Answer
Different answer, but I felt google-maps-directive is harder for me to use. Thus, I have created a google maps angularjs directive called, ng-map for my own project. This does not require any Javascript coding for simple functionality.
it looks like this
JavaScript
1
6
1
<map zoom="11" center="[40.74, -74.18]">
2
<marker position="[40.74, -74.18]" />
3
<shape name="circle" radius="400" center="[40.74,-74.18]" radius="4000" />
4
<control name="overviewMap" opened="true" />
5
</map>
6