我有我的 js 对象/数组
[Containerbox-1: Array(2)
0: "textbox-3"
1: "rediobox-4"
length: 2
__proto__: Array(0)
length: 0
__proto__: Array(0)]
谁将其转换为我使用过的字符串 JSON.stringify(); 但我得到的只是[]
我不确定这里有什么问题。
我已经public formFieldParent = [];
在我的 component.ts 中定义了这样的变量。而且我动态地推入其中的元素
if (isNullOrUndefined(this.formFieldParent[targetId])) {
this.formFieldParent[targetId] = []; <--- Adding key here
}
this.formFieldParent[targetId].push(idNm); <-- adding values here for key
当我对其进行控制台时,输出如上所示,并[]
通过使用返回JSON.stringify(this.formFieldParent);