Dear Stackoverflow friends,
I have a question, i'm busy with a NodeJS - Angular application. To save and delete parts of a form i use an object:
$scope.entries = {
events:{
save:{},
del:[],
save_count:0},
actions:{
save:{},
del:[],
save_count:0},
packages:{
save:{},
del:[],
save_count:0}
}
Now for example i have an object like this (saved in packages)
save:{
1398944325398:{
action: 6461,
budget: 1000,
events: [123, 1242],
id: 209
name: "Jeffrey"},
1398949842824:{
action: 6441,
budget: 1020,
events: [153, 12422],
id: 21
name: "Jeffrey2"}
}
So when i want to delete the key: 1398944325398 I have the following code:
delete $scope.entries.package.save['1398944325398'];
But when i send this object $scope.entries to my Node server i get this:
packages:{
del: Array[0],
save:{
1398944325398:{
events: Array[0]
},
1398949842824:{
action: 6441,
budget: 1020,
events: [153, 12422],
id: 21
name: "Jeffrey2"}
},
save_count: 0
}
Why won't javascript delete my object if there is an array in that object? Setting the array to 'null' Won't solve the problem
$scope.entries.packages
or$scope.entries.package
? (the missing 's' at the end). this makes a big difference – japrescott May 1 at 13:17