Skip to content

Commit

Permalink
Added a center property to the events example, and a listener for eve…
Browse files Browse the repository at this point in the history
…nts as suggested by @grantlucas here:

#104
  • Loading branch information
tombatossals committed Aug 20, 2013
1 parent dc1272d commit f51fbec
Showing 1 changed file with 37 additions and 27 deletions.
64 changes: 37 additions & 27 deletions examples/events-example.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
<html ng-app="demoapp">
<head>
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script src="../src/angular-leaflet-directive.js"></script>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<script>
var app = angular.module("demoapp", ["leaflet-directive"]);
app.controller("DemoController", [ "$scope", function($scope) {

$scope.events = {
'click': function(){
alert('Clicked');
console.log('You clicked on the map.');
}
}

}]);
</script>
</head>
<body ng-controller="DemoController">
<leaflet events="events" testing="testing" width="640px" height="480px"></leaflet>
</body>
</html>
<html ng-app="demoapp">
<head>
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script src="../src/angular-leaflet-directive.js"></script>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<script>
var app = angular.module("demoapp", ["leaflet-directive"]);
app.controller("DemoController", [ "$scope", function($scope) {

$scope.center = {
lat: 51.505,
lng: -0.09,
zoom: 8
};

$scope.$on('leafletDirectiveMap.click', function(e, args) {
console.log("Map click event caught in listener");
});

$scope.events = {
'click': function(){
alert('Clicked');
console.log('You clicked on the map.');
}
}

}]);
</script>
</head>
<body ng-controller="DemoController">
<leaflet events="events" center="center" testing="testing" width="640px" height="480px"></leaflet>
</body>
</html>

0 comments on commit f51fbec

Please sign in to comment.