I want to make an object using angular.forEach() function and then I need to push another object and initialize all the values to false but the below way points errors.
How can do this correctly? if I use "item.id" and "index.id" it will not create the intended functionality. I am attaching a photo to point out the intended functionality.link for image
angular.forEach(metaData.validationRules, function (item, key) {
//want to push object to another object
angular.forEach(insarray.instances, function (index, key) {
$scope.select = {
item.id: {
index.id:false
}
}
});
});
item.id's with the same value the last will overwrite the others.Objectis a collection of key=>value. You should mention key which will hold value..