I have an array
$scope.headArray=[
'Online & Open Alarms',
'Sites Overview',
'Active Alarms',
'Hidden Alarms'
];
and i have an object:
$scope.dashboardstatus = {
hideDashboard1:true, closeDashboard1:false,
hideDashboard2:true, closeDashboard2:true,
hideDashboard3:false, closeDashboard3:false,
hideDashboard4:false, closeDashboard4:false
}
and i want to create this table :
$scope.dashArray = [
{Online & Open Alarms:{hideDashboard1:true,closeDashboard1:false}} ,
{Sites Overview: {hideDashboard2:true,closeDashboard2:true}},
Actives Alarms: {hideDashboard3:false,hideDashboard3:false},
{Hidden Alarms: {hideDashboard4:false,closeDashboard4}}
]
I tried this :
for (var i=0; i< $scope.headingArray.length; i++){
$scope.dashArray.push({$scope.headingArray[i],
{$scope.dashboardstatus['closeDashboard'(i+1)],$scope.dashboardstatus['hideDashboard'+(i+1)]}}
);
}
but not work !
How to push data into dashArray?
[{Online & Open Alarms:{hideDashboard1...$scope.dashArrayis invalid.dashArrayas shown is invalid, but the desired goal seems clear to me, it's just a notational issue... (I hope.)$scope.headArrayin one place but$scope.headingArrayin another, being sure not to leave out operators ('closeDashboard'(i+1)), etc.