As a newcomer to Angular, I require assistance on how to insert an item into the markers.venues
.
This is my current code:
var app = angular.module("basicMapApp", ["leaflet-directive"]);
app.controller("CenterController",
[ '$scope', function($scope) {
angular.extend($scope, {
defaults: {
tileLayer: "https://dnv9my2eseobd.cloudfront.net/v3/foursquare.map-ikj05elx/{z}/{x}/{y}.png",
maxZoom: 14,
minZoom: 3,
},
center: {
lat: 52.38,
lng: 4.8777,
zoom: 6
},
markers: {
venues: {
Madrid: {
lat: 52.38,
lng: 4.8777,
message: "This is Madrid. But you can drag me to another position",
focus: false,
draggable: true
},
Barcelona: {
lat: 52.38,
lng: 5.8777,
message: "This is Barcelona. You can't drag me",
focus: false,
draggable: false
}
}
}
});
}]
);
Could someone please guide me on how to add a new item in the markers.venues
using JavaScript?
I attempted the following but it did not work as expected:
$scope.markers.venues.push({
Amsterdam: {
lat: 52.38,
lng: 5.9777,
message: "This is Amsterdam. You can't drag me",
focus: false,
draggable: false
}
});
If you need more information on Angular leaflet, refer to the documentation here