私はunderscore.jsを使用しています。私はselectedCharges
配列のループをアンダースコアeach
関数を使用してループしますが、ループ内のselectedCharges
変数にアクセスすることはできません。underscore.js each functions
_.each(this.selectedCharges, function(selectedCharge, key){
if(selectedCharge._id == charge._id){
this.selectedCharges.splice(key,1); // get error from this line
}
});
はこれを削除します。 ifで。これはあなたが現在 –
のように繰り返しているオブジェクトですか? selectedCharges.splice(key、1); –
コメントにコードを投稿しないでください。特に何の説明もなしではありません。 –