私は動的に作成されたオブジェクトを持っていて、何度かそれは配列であるプロパティーtheCtns.services["example"].expose
を持っていて、何度もそれを持っていません。ここにはバグはありません。オブジェクトにプロパティを追加するには?
それから私はやる方法があります:
if($('#labelExpose').children().length > 1){
$('#labelExpose').children('input').each(function (index) {
if(this.value){
console.log("value of expose field number:" + index );
console.log(this.value);
theCtns.services[ctn].expose[index] = this.value;
}
});
}else{
delete theCtns.services[ctn].depends_on;
}
をしかしexpose
がないので、私は次のエラーUncaught TypeError: Cannot set property '0' of undefined
を持っていますが、それは= this.value
権利でそれを作成する必要がありますか?
この問題を解決するにはどうすればよいですか?
私はこのようにしてみてください、私はあなたが、これは動作しませんでしたと言って、 – Jerome
申し訳@Jerome後にここに戻ってきます? –
いいえいいえ私はあなたの答えでテストしますが、テストするのに10分必要です – Jerome