Markers don't show up even though no error is shown


#1

hi, again, me trying to create this locally: Actually, I already managed to get NearMe1 to work locally, showing the two markers from the controller. Then I bit my teeth out on NearMe 2 and when I "rolled back" my code to NearMe1 all of a sudden the Markers don't show up. Please have a look:

app.js (its all in there, because only that way will it work in my browser):

angular.module('NearMeApp',['leaflet-directive','ngRoute']).
config(['$routeProvider',function($routeProvider){
	$routeProvider.
		when('/',{
			templateUrl: 'js/views/main.html',
	  		controller: 'MainController'    
		}).
		when('/about',{
			templateUrl: 'js/views/about.html',
	  		controller: 'AboutController'
		}).
		otherwise({
			redirectTo: '/'
		});
}]).
controller("MainController", ['$scope', function($scope){
	$scope.mapCenter = {
		lat: 40.741934,
      	lng: -74.004897,
      	zoom: 17
	};
	$scope.mapMarker = [{ 
		lat: 40.741389, 
		lng: -74.003056, 
		message: "111 Eighth Avenue" 
	}, 
	{ 
		lat: 40.7425, 
		lng: -74.006111, 
		message: "Chelsea Market" 
	}];
}]);

index.html:

<!Doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Near Me</title>
		<script src="js/vendor/angular.min.js"></script>
		<script src="js/vendor/leaflet.js"></script>
		<script src="js/vendor/angular-leaflet-directive.min.js"></script>
    <!-- <script src="js/vendor/helpers.js"></script> -->
		<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular-route.js"></script>
		<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.1/leaflet.css">
		<link href="https://s3.amazonaws.com/codecademy-content/projects/bootstrap.min.css" rel="stylesheet">
		<link href="css/main.css" rel="stylesheet" />
	</head>
	<body ng-app="NearMeApp">
    	<div class="header">
      		<div class="container-fluid">
        		<h1 class="pull-left">NearMe</h1>
        		<a class="pull-right" href="#/about">About</a>
      		</div>
    	</div>
   		<ng-view></ng-view>

    <!-- Modules -->
    

    <script src="js/app.js"></script>
    <!-- Controllers -->
    <!-- <script src="js/controllers/MainController.js"></script> -->
    <!-- <script src="js/controllers/AboutController.js"></script> -->
    <!-- Directives -->
    
    <!-- Services -->
    <!-- <script src="js/services/places.js"></script>  -->
  </body>
</html>
    <!-- <script src="https://code.angularjs.org/1.2.28/angular-route.min.js"></script> -->

#2

god this is embarrassing: i just didn't name the mapMarkers correctly, they should have been plural. now all fine.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.