I feel like this may involve strings and a forEach statement? I'm pretty new to angular, but basically what I would like to do is this:
I have two objects, where every variable in object 1 is in object 2, but object 2 has more variables than object 1. I need to set all the values that the two share to be equal.
My guess would be perhaps going through Object 1 using forEach and setting the names of its variables to a string, then setting Object2.nameOfVariable equal to the item that the iterator is currently on?
This is a mockup that made sense in my head, but I have a poor understanding of forEach, and thus this does not work:
(in a factory)
loadValues: function(object1, object2) {
object1.forEach(item){
var varName = angular.toString(item);
object2.varName = item;
}
return object1;
},