i am working with AngularJS dynamic forms . According to my userid value i generated multiple form field with same model name using ng-repeat. i am not able to get this input model values due to this ng-repeat. in this example i am using static userid data.
<div ng-app="myApp">
<div ng-controller="myCtrl">
<form role="form" name='userForm' novalidate>
<div class="container">
<div class="row" ng-repeat="myid in userid">
<div class="form-group">
<div class="col-md-3">
<label>ID</label>
Let's shift our focus to the JavaScript portion where the functionality is controlled and manipulated:
<pre><code>var myApp = angular.module('myApp', []);
myApp.controller('myCtrl', function($scope) {
$scope.userid = [1, 2, 3];
$sope.adduser = function() {
}
});
As I venture towards sending an array of objects to the server, a concern arises regarding handling dynamic userids with an excess of 100 data points. How can I extract each field's model value comprehensively? Furthermore, what approach should be adopted to convert these model data entries into an array of objects resembling the sampleServerData structure showcased below?
i am expecting my final output data like this
var sampleServerData = [{
"userid": 1,
"manualcomment": "mycmt1",
"gender": "male"
}, {
"userid": 2,
"manualcomment": "mycmt2",
"gender": "male"
}, {
"userid": 3,
"manualcomment": "mycmt3",
"gender": "female"
}]