0
有人可以看看这个,并有意义如何把它变成本地的JS。下划线的方法ES6
_.chain(polls).deepClone().indexBy("id").value()
我试图查找deepClone
,无法找出它从何而来。这是我接管的代码,并不太熟悉它。感谢帮助。
这里是一个工作示例,我有:
function loadPolls() {
return ScheduledEventService.getPolls($scope.webcastId)
.then(function(polls){
$scope.originalPolls = _.chain(polls).deepClone().indexBy("id").value();
$scope.webcast.polls = polls;
_.each(polls, function(poll){
poll.answers = _.map(_.range(Polls.MaxAnswers), function(i){
return (poll.answers && poll.answers[i]) || {};
});
poll.readOnly = poll.status !== "Closed" || poll.totalResponses > 0;
});
});
}
哎哟-1。原因呢? – pertrai1
你能提供工作示例吗? –
@PratikParekh - 我希望我所添加的帮助 – pertrai1