我有这个功能,但每个变量只有一个对象,但输入中有3个对象的数组。
ctrl.func = function (oldDetails, newDetails) {
var oldDetailsCollection =[];
var newDetailsCollection = [];
_.forEach(oldDetails, function (oldDetails) {
oldDetailsCollection = _.find(oldDetails.doctorDetails);
});
_.forEach(newDetails, function (newDetails) {
newDetailsCollection = _.find(newDetails.doctorDetails);
});
}
现在,oldDetailsCollection和newDetailsCollection具有与下面完全相同的属性:
iD
doctorName
此外,input包含3个具有上述属性的对象的数组,但我只得到一次属性值。我缺少什么或如何纠正这个以存储3的数组?
示例:
我有这个:
iD = 1 doctorName = "Alice"
iD= 2 doctorName = "Brown"
iD = 3 doctorName = "Stu"
但是,我只得到第一个值