Updating All Values in "ng-repeat" Using AngularJS

I am facing an issue with ng-repeat where only the last value of "frais" is being updated. Is there a way to update all values displayed by ng-repeat?

Here is the code from file.html:

<ion-content class="padding" ng-controller="FactureAdminCtrl" ng-repeat="selectedName in selected">

<ion-list ng-repeat="selectedName in selected">
          <div class="item item-divider center-text" name="codeE" ng-model="selectedName.CodeEnvoiColis"> {{selectedName.CodeEnvoiColis}} </div>  

          <label class="item item-input">
          <input width="20%" type="text" placeholder="Frais" ng-model="selectedName.FraisFact" style="color:#BA1B1B;"></div> 
          </label>
</ion-list>  

<a class="button button-info" href="#/factureAdmin" ng-click="updateFact(selectedName)"> Submit </a>

And this is from app.js:

 $scope.updateFact = function(selectedName){ 

           $http.post(  
                "http://localhost/deb/insertFact.php",  
                { 
                'FraisFact':$scope.selectedName.FraisFact,
                'CodeEnvoiColis':$scope.selectedName.CodeEnvoiColis,
              }
           ).success(function(data){  
                alert(data);                                
           });  
    } 

Answer ā„–1

It is essential to assign distinctive identifiers or names to HTML elements for a well-organized structure.
Consider this straightforward illustration:

<div id="unique-container">
  <ul class="item-list" data-item-id="selected-name">
    <li><input type="text" class="form-control" data-model="document-title"></li>
  </ul>
</div>

Answer ā„–2

    <ion-content class="padding" ng-controller="FactureAdminCtrl"  ng-repeat = "selectedName in selected">   
    <ion-list ng-repeat = "nameSelected in selected track by $index">
              <div class="item item-divider center-text" name="myCodeE" ng-model="nameSelected.MyCodeEnvoiColis" > {{nameSelected.MyCodeEnvoiColis}} </div>

              <label class="item item-input">
              <input width="15%" type="text" placeholder="Shipping Cost" data-comment= "nameSelected.ShippingCostFact" ng-model="ShippingCostFact[$index]" name="ShippingCost{{$index}}" style="color:#BA1B1B;"></div> 

              </label>
    </ion-list>
<a class="button button-info" href="#/factureAdmin" ng-click=insertFact(nameSelected)> Add </a> 

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

Having trouble with Installing ownCloud on Raspberry Pi

Every time I attempt to open ownCloud, an error message appears stating: PHP module mb multibyte not installed. Please ask your server administrator to install the module. PHP modules have been installed, but they are still listed as missing? Please ask y ...

The implementation of adding and removing buttons in the ui-grid interface through cell templates

Is there a way to ensure that the add button only appears on the last record in the grid? Below is the code snippet used in the cell template: cellTemplate: '<button class="btn primary" ng-click="grid.appScope.deleteRow(row)">Delete</button ...

I'm looking to use $resource to generate a unique query that can pass arguments to the find method in mongoose through req.body. How can I accomplish

I would like to implement a custom query method in this manner: $scope.modules = dataFac.getModules().customQuery({name: /test/}) .$promise.then(function(response){ $scope.modules = response; ...

Finding your current location and address using HTML5 geolocation

My web application utilizes HTML5 geolocation to obtain latitude and longitude coordinates. I am looking for a way to convert these coordinates into actual addresses whenever possible. Once that is done, I need to save the address information into a MySQ ...

PHP not delivering a variable via AJAX

I've noticed that there are similar questions on this platform, but I've spent my entire day researching and fixing bugs to figure out why my ajax code doesn't return a response from the php file. All I need is for it to notify me when a use ...

Is there a way to showcase the uploaded file contents on the current page without the need to refresh?

Is there a way to display the contents of an uploaded file on the same HTML page without opening a new tab or refreshing it? I have the following HTML and PHP codes for reading an uploaded file in a separate page, but I want to integrate it into the same H ...

What is the best way to use shortcodes to display custom fields for post objects, specifically products, within WordPress posts

I'm in the process of displaying 'featured products' within my blog posts. These specific products need to be chosen using custom post objects on the backend for each individual post. I've outlined what I believe the PHP code should lo ...

What is the best way to send variables from JavaScript to PHP while utilizing Ajax technology?

While I have noticed similar questions like this one before, I want to address my specific concerns. In previous examples, the questioner referred to using Ajax in a format similar to this: $.ajax({ type: "POST", url: 'logtime.php', ...

Create a personalized edit button for ContentTools with a unique design

I'm struggling to figure out how to customize the appearance and location of the edit button in ContentTools, a wysiwyg editor. After some research, I learned that I can use editor.start(); and editor.stop(); to trigger page editing. However, I want ...

How come I am unable to return an array from an angular factory function if arrays are considered objects?

Why is it that we can return an object, but not an array if an array is also an object? ...

imported classes from a module cannot be accessed within the same module

Here is some TypeScript code that I wrote: Within my module, I am importing a library called ts-events. import {SyncEvent} from 'ts-events' module MyModule{ export class MyService{ } } In the same module but in a different file, I'm ...

Executing multiple Ajax requests on CodeIgniter 3 from two separate pages

I am facing a critical need for a code review and unfortunately, I am unsure of where else to seek assistance besides here. Let me outline my current task: I am working on a user profile page that is designed to showcase users' comments. Users have t ...

The callback function in AngularJS' $http is failing to trigger

$scope.submitNewUser = function() { $http({ method: 'POST', url: 'api/user/signup', data: {'user': $scope.user}, headers: {'Content-Type': ...

Error: Page cannot be located 404 (GET /) ā€¢ Directory not found: C:/wamp/www/fatfree-master/index.php:111 Base->execute()

Recently, I decided to give the php fat free framework (also known as F3) a try in order to quickly construct a web application. Despite reading through the documentation and thinking it would be straightforward, I have been encountering a single issue th ...

Tips for organizing the output of wp_query

I'm looking to organize the results of my wp_query, wanting to arrange them by different parameters without needing to run the query again. Here is what I have so far: $the_query = new WP_Query( $args ); Iā€™d like to sort $the_query; WP_Query gives ...

Exploring the process of sending post data and navigating to a URL using AngularJS

I am working on an application using angularjs 1.6 and Java 8. My goal is to send POST data to another application and navigate to the URL that this external application determines. The purpose of my application is to transmit data about a citizen who wan ...

What is the earliest version of git required to run composer?

My website is hosted and I am looking to use composer to manage my project dependencies on the production server. However, I keep encountering an error every time I try to run composer update: $ [RuntimeException] Failed to execute git status --porce ...

Tips for compressing multiple images into a single file using php after they have been downloaded

I have a PHP code that downloads multiple images from private websites. My goal is to place all these images into a zip file. How can I achieve this? <?php $num = $_POST['num']; for ($i=1; $i <= $num ; $i++) { $url_to_image = $_POST ...

Issues with ng-model disappearing while using ng-include (AngularJS)

Currently working on an Android app with Ionic and AngularJS. Using ng-include to include HTML content in the app's pages. checkbox.html: <ul> <li ng-repeat="opt in $parent.checkboxOptions"> <h4> ...

What is the best way to send data using ajax?

I'm looking to send variables from post.php to addcomment.php using an AJAX request. I've attempted the code below, but it's not functioning as expected. The page reloads, but no changes occur, and there's no data being added to the dat ...