I am making an app that requires the user to click on a location and then will be directed to the location via Google Maps.The locations are an array of objects. This is what the location files look like.
$scope.SiteLocs = [
{
"name": "502 Nelson St, Greenville, MS 38701",
"visibility": "0",
"description": "502 Nelson St, Greenville, MS 38701",
"styleUrl": "#waypoint",
"Point": { "coordinates": "-91.05636,33.415485,0" }
},
{
"name": "242 Blackhawk Trace, Galena, IL 61036",
"visibility": "0",
"description": "242 Blackhawk Trace, Galena, IL 61036",
"styleUrl": "#waypoint",
"Point": { "coordinates": "-90.319778,42.390862,0" }
},
{
"name": "3747 Ocean Dr, Vero Beach, FL 32963",
"visibility": "0",
"description": "3747 Ocean Dr, Vero Beach, FL 32963",
"styleUrl": "#waypoint",
"Point": { "coordinates": "-80.358248,27.659094,0" }
}, ect...
I want to add another element to every item in the array.
I tried adding it in through the .concat() method but that didn't seem to work.
If I wanted to add "carrier": "sprint", to each location how would I do that?
I forgot to add this bit of code. It splits and reorders the coordinates in the files.
angular.forEach($scope.SiteLocs, function(location) {
var clength = location.Point.coordinates.length;
if (location.Point.coordinates.substring(clength - 2, clength) === ",0") {
location.Point.coordinates = location.Point.coordinates.substring(0, clength - 2).split(",");
Lat = location.Point.coordinates[0]
Lon = location.Point.coordinates[1]
Com = ","
location.Point.coordinates = Lon.concat(Com,Lat)
}