Navigating through objects within arrays within objects in Angular

I seem to be encountering some difficulty in displaying data from an API call on Mapbox. Only one marker is showing up on the map instead of the expected 10 markers. I suspect there might be an issue with my ng-repeat implementation, but I can't pinpoint exactly what it is. Any assistance would be greatly appreciated.

For anyone interested, here is a link to view the complete JSON response from the API call

// index.html
  <div ng-repeat="venue in bars.venues">
    <marker lat="{{venue.location.lat}}" lng="{{venue.location.lng}}">
      <h1>{{venue.name}}</h1>
      <p>{{venue.contact}}</p>
      <p>{{venue.location.formattedAddress}}</p>
    </marker>
  </div>

// app.js
    $http.get(url)
      .then(function (response) {
        $scope.bars = response.data.response;
    });

// sample data from api
{
  "meta": {
    "code": 200,
    "requestId": "55e72707498e3d9a002d7bc4"
  },
  "response": {
    "venues": [
      {
        "id": "42c1e480f964a520c4251fe3",
        "name": "The View",
        "contact": {
          "phone": "4158961600",
          "formattedPhone": "(415) 896-1600"
        },
        "location": {
          "address": "55 4th St",
          "crossStreet": "at Marriott Marquis",
          "lat": 37.78510950100554,
          "lng": -122.40469515323639,
          "distance": 29,
          "postalCode": "94103",
          "cc": "US",
          "city": "San Francisco",
          "state": "CA",
          "country": "United States",
          "formattedAddress": [
            "55 4th St (at Marriott Marquis)",
            "San Francisco, CA 94103",
            "United States"
          ]
        },
        "categories": [
          {
            "id": "4bf58dd8d48988d1d5941735",
            "name": "Hotel Bar",
            "pluralName": "Hotel Bars",
            "shortName": "Hotel Bar",
            "icon": {
              "prefix": "https://ss3.4sqi.net/img/categories_v2/travel/hotel_bar_",
              "suffix": ".png"
            },
            "primary": true
          }
        ],
        "verified": false,
        "stats": {
          "checkinsCount": 12634,
          "usersCount": 9499,
          "tipCount": 121
        },
        "url": "http://www.sfviewlounge.com",
        "hasMenu": true,
        "menu": {
          "type": "Menu",
          "label": "Menu",
          "anchor": "View Menu",
          "url": "https://foursquare.com/v/the-view/42c1e480f964a520c4251fe3/menu",
          "mobileUrl": "https://foursquare.com/v/42c1e480f964a520c4251fe3/device_menu"
        },

Answer №1

After some investigation, I discovered the reason behind only one marker being displayed. It turns out that when I had ngMaps as a module in my angular google maps setup, it was causing the issue. Once I removed it, all of my markers appeared as expected.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to extract and format data from a database using unserialize, json decode, or implode functions in Laravel Blade?

After collecting data from a form using various methods such as Serialize, Implode, and Json_encode, the stored information looks something like this: Serialized Data +-------+----------------------------------------+------------------------------- ...

Tally up various figures in all tables

I am dealing with a dynamic table generated from a PHP loop. Below is an example of the table structure extracted from the browser source code: <table class="table"> ... (table content) </table> <table class="table"> ... (t ...

Transforming a pandas Dataframe into a collection of dictionaries

Within my Dataframe, I have compiled medical records that are structured in this manner: https://i.stack.imgur.com/O2ygW.png The objective is to transform this data into a list of dictionaries resembling the following format: {"parameters" : [{ ...

Updating objects in Angular 8 while excluding the current index: a guide

this.DynamicData = { "items": [ { "item": "example", "description": "example" }, { "item": "aa", "description": "bb" }, ...

What is the process for converting this Greasemonkey code to JavaScript specifically for Android devices?

Having trouble loading a page and running a JavaScript code on it? Don't worry, you're not alone. I came across a Greasemonkey script that does the trick, but now I'm struggling to make it work on Android. It's probably because of my la ...

Is it possible for nextAll() to exclude a specific parent element and search only for children inside that parent?

Below is the structure of my html ajax form: <form name="vafForm" id="vafForm" method="GET" action="urlfor ajax"> <input type="hidden" value="0" id="vafProduct"> <select class="catSelect {prevLevelsIncluding: 'cat'} c ...

Struggling with React: Attempting to store retrieved data in a variable, only to find the variable empty

After fetching JSON data using async await, I attempted to store the fetched data in a variable so that it can be used with a map function in my component. While the data is properly received within the function (confirmed by an alert) and displayed cor ...

Troubleshooting Challenges in JavaScript/jQuery Hangman Game

Having trouble with my hangman game's game loop. Attempting to replace correct letters as the game runs through the word, but it's currently: looping through the word checking if the guessed letter is in the word returns index[0] Tried splitti ...

Tips for triggering the API call only when a change is detected

#In the provided code snippet, the useEffect hook is being used to fetch data from an API using the apiData() function. The data retrieved consists of objects with properties such as id, name, parent name, and isActive. The isActive property is linked to ...

What is the best way to showcase just 5 photos while also incorporating a "load more" function with

Is there a way to display only 5 images from a list on the first load, and then show all images when the user clicks on "load more"? Here is the code I have: $('.photos-list').hide(); $('.photos-list').slice(1, 5).show(); $ ...

I am experiencing an issue where the Mongo item ID is not being successfully passed through the REST API

Recently, I've been working on developing a blog site for my class project. The main goal is to create a REST API for the blog site. I have successfully managed to display data from the database using .ejs views, except for one issue. I am facing diff ...

Tips for displaying dynamic content in VueJS?

I'm currently working on an app that allows users to choose which type of vuetify element they want to display on the page. There are 4 options available for selection. My goal is to render the corresponding vuetify component when a user clicks on the ...

Inject a snippet of temporary code at the end of the CSS file using JavaScript or JQuery

I am looking to dynamically add temporary CSS code to the end of an external CSS file or modify it using JavaScript or jQuery. For example, let's say my mystyle.css file looks like this: //mystyle.css p{color:red} Now, when a user interacts with the ...

Executing a function from another module (File) within a React JS application

I am currently utilizing the Material UI v1.0.0-beta.33 in my project, which includes an App Bar component. import React from "react"; import PropTypes from "prop-types"; import { withStyles } from "material-ui/styles"; import AppBar from "material-ui/App ...

Providing hosting for static files that allows for html5mode with necessary URL rewriting

Is there a way to host my static files with html5mode support without setting up a server? It seems like html5mode requires url rewriting for the virtual URLs generated by Angular. Are there any CDNs that offer this kind of support? Could Firebase Hostin ...

Locates every document where an array field includes a document that meets specific criteria

I am currently working with a MongoDB collection that stores all user data. Each document in my collection is represented in JSON format as follows: { "_id" : ObjectId("542e67e07f724fc2af28ba75"), "id" : "", "email" : "<a href="/cdn-cgi/l/ ...

Can you provide guidance on how to successfully transfer an array of JSON objects from the script section of an HTML file to the JavaScript

My webpage contains an array of JSON objects that I need to send to the server. The array, stored in a variable called results, appears normal when checked in the console before trying to POST it. Here is a sample of the data: 0: {id: 02934, uName: "Ben", ...

Is there a way to automatically scroll to the last dynamically added div?

Within the chat.html file, I have included a div tag and implemented a script that dynamically adds rows to the div when a button is clicked. In another file named list.html, I have inserted an iframe tag with the src attribute pointing to chat.html. Howev ...

What is the process of installing an npm module from a local directory?

I recently downloaded a package from Github at the following link: list.fuzzysearch.js. After unzipping it to a folder, I proceeded to install it in my project directory using the command: npm install Path/to/LocalFolder/list.fuzzysearch.js-master -S Howe ...

Babel is failing to transpile the Modal component from material-ui-next to ES5

Issue with Babel transpiling Modal component from material-ui-next Here is my .babelrc configuration: { "presets": ["es2015", "react", "stage-1", "stage-2", "stage-3"] } This is the webpack-config.js setup: var webpack = require('webpack'); ...