AngularJS - Enhancing a nested JSON object

I am trying to modify the player's name and numbers in the JSON server URL using AngularJS. Can anyone provide guidance on how to achieve this? Thank you.

{
"id": 1,
"Team": "Arsenal",
"Manager": [
{
  "id": 1,
  "Name":"Arsene_Wenger",
  "Players": [
    {
      "id": 1,
      "Name": "Welbeck",
      "Number": "23"
    },
    {
      "id": 2,
      "Name": "Ramsey",
      "Number": "16"
    }
  ]
}
]
}

Answer №1

To link the HTML and JSON models, you can easily bind an ng-model on the HTML side like this:

<div ng-repeat="person in Basketball.Team[0].Players;">
 <input type="text" ng-model="person.Name" > {{person.Name}}</input>
 <input type="text" ng-model="person.Number" >{{person.Number}}</input>
</div>

Any changes made to the HTML model will automatically reflect in the JSON model.

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

Exploring the Latest Features of Node.js

I am currently diving into the WebRTC tutorial provided by Google's codelab. Within the Node.js index.js section, I came across the following line of code: var fileServer = new(nodeStatic.Server)(); I know that new is used as an operator to create ...

"Enhance Your Video Experience with a Personalized Play Button

Is it possible to customize the play icon for an embedded YouTube video? I came across a post discussing this topic: Can I change the play icon of embedded youtube videos? However, when trying to use something transparent as the new play button, the origin ...

What is the best way to store multiple values under the same key in an NSDictionary using an array of JSON objects?

Is it possible to set multiple values for the same key, or should they be stored in an array? In my code, I have an NSArray named friMainDicArray containing JSON objects: { day = 0; "end_time" = "17:30"; "english_event" = "Lion Da ...

Display a loading bar while uploading files in an Angular directive

How can I implement a progress bar in an Angular directive for file uploads? app.directive('uploadPanel', function () { return { restrict: 'E', scope: { action: '@' }, }) ...

Puppeteer facing limitations on Heroku deployment

Recently, I deployed an application on Heroku and included the Puppeteer Heroku buildpack. However, upon attempting to run it after a successful redeployment, I encountered a failure. Upon checking the error message using heroku logs -t, I found the follo ...

Showing the loading screen while waiting for the static Next.js app to load

Looking for a way to implement a loading screen right before the entire static page finishes loading? I'm currently utilizing modules:export to create my static page, but struggling to listen to the window load event since NextJs has already loaded th ...

Using the power of AJAX, retrieve data from a PHP script and showcase the response within

Within my HTML file, I have implemented a feature that allows users to input a value. To validate this input, I created a PHP script that checks if the entered value exists in the database. The script returns the following JSON response: {"active":true} ...

Is there a way to automatically refresh the page and empty the input fields after clicking the submit button on the contact form?

My knowledge of PHP and js is limited, so I may require additional guidance in incorporating those codes. Lately, I've been developing a contact form and making good progress. However, I'm struggling with figuring out how to refresh the page or ...

What is the best way to arrange the keys of a JavaScript object in a customized

I am struggling to find a way to custom sort a JavaScript object properly. For example, I have the following object: var test = { 'yellow': [], 'green': [], 'red': [], 'blue': [] } And an array with values ...

Obtain a collection of strings from an array of objects based on specified criteria

What is the most efficient method to extract an array of specific strings from an array of objects, where a certain condition needs to be met? Solution Attempt: const array = [{ "Item": "A", "Quantity": 2 ...

Steps to generate a fresh array from a given array of objects in JavaScript

Looking to transform an existing array into a new array of objects in Vue.js. Here's the initial array : import { ref } from 'vue'; const base_array = ref([ {id: 1, name: Pill, timing: [morning, noon, evening, night]}, {id: 2, name: Ta ...

Vue.js / Nginx / Node.js - Error 413: Payload Too Big

My frontend is built using Vue.js and is hosted on an nginx server in production. Here's a snippet of my nginx.conf configuration: server { listen 80; server_name localhost; root /usr/share ...

The Service Worker seems to be neglecting to serve the sub-pages at

I've successfully implemented a service worker on my website. The home page loads correctly from the Service Worker cache, and when I visit previously viewed 'posts' while online in Chrome, they load and show as 'from ServiceWorker&apos ...

When using D3.js, the d3.json method may result in an Uncaught TypeError where it is unable to read the property '0' of

I lack knowledge in javascript and JSON, and I'm unsure why my code isn't functioning correctly. A portion of my JSON data is provided below: [{'Africa' : {'children':[{stuff}], 'name': 'Africa'} ...other ...

TSDX incorporates Rollup under the hood to bundle CSS Modules, even though they are not referenced

I have recently developed a React library with TSDX and you can find it here: https://github.com/deadcoder0904/react-typical This library utilizes CSS Modules and applies styles to the React components. Although the bundle successfully generates a CSS fi ...

Alter the Color of the 'div' According to the Background

At the bottom right of my website, there is a black chatbot icon. The web footer also has a black background. To create a clear contrast, I have decided to change the color of the chatbot to white as users scroll to the bottom of the page. I implemented t ...

Implementing border-right leads to alignment problems

I'm currently working on creating a list with bootstrap-Accordion using react-bootstrap. I'm applying a background color and border left to the selected item. The problem I'm facing is: Whenever I activate a bar, the text shifts to the rig ...

Indicator malfunctioning on Carousel feature

I created a carousel containing six photos, but I am encountering an issue with the carousel indicators below. The first three indicators work correctly – when clicked, they take me to the corresponding slide (e.g., clicking the 1st indicator takes me ...

Enhance the aesthetics of your React material-table by implementing color-coded rows in the

Utilizing material-table within my React project has been a great help. I have implemented a data tree with 3 levels, starting with the first level shown here: https://i.sstatic.net/Njm8J.png I am wondering if there is a way to highlight the first item a ...

SpringMVC is having trouble generating the correct JSON responses for Boolean properties

After setting up a REST Controller in SpringMVC 4.2.5, I am not getting the desired response. Let me provide you with more details. I have an Entity called propertyEntity, public class PropertyEntity implements Serializable, Cloneable { private static ...