我需要将一个 JSON 对象推送到 AngularJS,并且需要先检查其中一个对象的值是否存在。我需要覆盖数据。
$scope.setData = function(survey, choice) {
keepAllData.push({
'surveyId': survey.id,
'choiceId': choice.id
});
console.log(keepAllData);
toArray(keepAllData);
alert(JSON.stringify(toArray(keepAllData)));
$scope.keepAllDatas.push({
'surveyId': survey.id,
'choiceId': choice.id
});
var items = ($filter('filter')(keepAllDatas, {
surveyId: survey.id
}));
}
function toArray(obj) {
var result = [];
for (var prop in obj) {
var value = obj[prop];
console.log(prop);
if (typeof value === 'object') {
result.push(toArray(value));
console.log(result);
} else {
result.push(value);
console.log(result);
}
}
return result;
}
Run Code Online (Sandbox Code Playgroud)
如果keepalldata中存在调查id,我需要使用choiceid更改最近的值。可以用 AngularJS 来做吗?
当我尝试使用包含超过64000条记录的apache poi将数据写入excel表时,使用SXSSF并且我收到以下错误,
检测到拉链炸弹!该文件将超过最大值.压缩文件大小与扩展数据大小的比率.这可能表示该文件用于夸大内存使用量,因此可能带来安全风险.如果需要处理超出此限制的文件,可以通过ZipSecureFile.setMinInflateRatio()调整此限制.计数器:820224,cis.counter:8192,比率:0.009987515605493134Limits:MIN_INFLATE_RATIO:0.01
我找到了一个解决方案,通过添加ZipSecureFile.setMinInflateRatio(0.009)来说明,我需要知道它为什么会发生以及我需要为上述错误广告提供的限制在哪里添加解决方案,解决方案的参考:( 如何确定检索Excel文件时是否抛出Zip Bomb错误样式表是否合法?)
如果有任何其他解决方案,请告诉我