Reputation: 925
I have this code because I want inlude the Google maps in my webApp but don't work. This is the page html:
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="js/libs/angular.js/angular.js"></script>
<script src="js/libs/angular.js/angular-route.js"></script>
<script src="http://maps.google.cn/maps/api/js?sensor=false"></script>
<script src="js/libs/mappa/lodash.js"></script>
<script src="js/libs/mappa/angular-google-maps.min.js"></script>
</head>
<body>
<div>
<ui-gmap-google-map center=map.center zoom=map.zoom style="width: 400px; height: 400px;"></ui-gmap-google-map>
</div>
</body>
</html>
This is my controller in AngularJs:
var modulo = angular.module('progetto', ['ngRoute', 'uiGmapgoogle-maps']);
modulo.controller('descriptionController', function ($scope, $routeParams, $http) {
$scope.map = { center: { latitude: 45, longitude: -73 }, zoom: 8 };
}).
error(function (data, status) {
$scope.listaEventi = "Request failed";
});
Where is the error? I think that i import exact library!
Upvotes: 0
Views: 255
Reputation: 3828
You need to define this css rule:
.angular-google-map-container { height: 400px; }
Inline style on your directive is not good enough.
Here's a working fiddle... http://jsfiddle.net/ybtn4kn2/
Upvotes: 1
Reputation: 322
You seem to have forgotten your
<div ng-controller="descriptionController">
And you will need to pass in the library to the controller
.controller("descriptionController", function($scope, uiGmapGoogleMapApi)
Upvotes: 0