I'm looking to update each item in an array by pushing a scope variable into it. This is my current code:
$scope.ProcessExcel = function (data) {
//Read the Excel File data.
var workbook = XLSX.read(data, {
type: 'binary'
});
//Fetch the name of First Sheet.
var firstSheet = workbook.SheetNames[0];
//Read all rows from First Sheet into an JSON array.
var excelRows = XLSX.utils.sheet_to_row_object_array(workbook.Sheets[firstSheet]);
//Display the data from Excel file in Table.
$scope.$apply(function () {
$scope.AgedaItems = excelRows;
});
};
The array is $scope.AgendaItems and it's filled with excel data.
It currently looks like this:
https://i.sstatic.net/6z8SJ.png
Now, I need to insert the value of a variable called $scope.meetingId into each record so that the array looks like this after the push:
$scope.AgedaItems: Array(5)
0: {MeetingId: "49490", AgendaItem: "1", LegistarID: "61613", Title: "Title#1", __rowNum__: 1}
1: {MeetingId: "49490", AgendaItem: "2", LegistarID: "60826", Title: "Title#2", __rowNum__: 2}
2: {MeetingId: "49490", AgendaItem: "3", LegistarID: "61168", Title: "Titel#3", __rowNum__: 3}
3: {MeetingId: "49490", AgendaItem: "4", LegistarID: "61612", Title: "Title#4", __rowNum__: 4}
4: {MeetingId: "49490", AgendaItem: "5", LegistarID: "60646", Title: "Title#5", __rowNum__: 5}
If anyone could guide me on how to achieve this, I would greatly appreciate it.
Thanks, Erasmo