Trying to incorporate Angularjs multiselect into my project, however, whenever I try to pull the data from my mysql database, only the last record is being displayed.
html
<div isteven-multi-select
input-model="allPersonnelGrouped"
output-model="groupedOutput"
button-label="icon name"
item-label="icon name maker"
tick-property="ticked"
max-height="250px"
group-property="msGroup">
</div>
angularjs
$http.get('/messages/shifts').success(function(data) {
$scope.groupedShifts = data;
angular.forEach( $scope.groupedShifts, function( groupShift ) {
$scope.allPersonnelGrouped = [
{ name: '<strong>All Shifts</strong>', msGroup: true },
{ name: '<strong>' + groupShift.title + '</strong>', msGroup: true },
{ icon: '', name: groupShift.personnel, maker: '(' + groupShift.email + ')', ticked: false },
{ msGroup: false },
{ msGroup: false }
];
});
});
array of objects
[
{
"id": 1,
"title": "Shift 1",
"email": "[email protected]",
"personnel": "Johnny Depp"
},
{
"id": 2,
"title": "Shift 2",
"email": "[email protected]"
"personnel": "Napoleon Bonaparte"
}
]
In the example the last object in the array of objects above, only the last object is shown and I need all of them to be displayed.
Essentially the output I am getting is

forEachloop you are creating a new array each time it executes. I was typing this as an answer (and w/a solution), but in doing so I realized I wasn't sure what your resulting array should look like. Should it be an array of objects (as you've shown above), or perhaps an array of arrays, where the inner array contains objects?