i have this object with arrays
$scope.filters = {
Sites: [],
Regions: [],
Devices : [],
Variables : [],
};
i want to push into Variables {'VariableName': 'Total Active Energy'};
i did this
var obj = {};
obj['VariableName'] = response.data[0].AutoReportVariable;
$scope.filters.Variables.push(obj);
console.log($scope.filters.Variables);
but in console I take :
0:{VariableName:'Total Active Energy'}
how can i push the value to take in console only {VariableName:'Total Active Energy'} without key 0 ?
i want this to have
$scope.filters = {
Sites: [],
Regions: [],
Devices : [],
Variables : [{VariableName:'Total Active Energy'}]
};
0is not key, its the index of arrayconsole.logshows you indexes too. What is your problem?? Maybe an object??