I have this data:
example: {
"jd5jasjs71kdskzaslsdfsdfsdfsdf" : {
param1: '',
param2: '',
param3: '',
param4: 'xx',
param5: 'xx',
advancedParams: {
aone: '',
atwo: '',
athree: '',
afour: 'blablabla'
}
},
I have this code which worked fine, until I figured out I'll need another set of data in the object to be implemented as form fields in later stages of the form I'm creating:
if (this.example.hasOwnProperty(this.someKey)) {
for (const [key, value] of Object.entries(this.example[this.someKey])) {
this.newInputs[key] = value;
}
}
someKey + newInputs(object) are from the Data()
What I'm trying to accomplish here is to divide fields to two new objects which will be rendered later as form fields.
Example:
newInputs: {
param1: '',
param2: '',
param3: '',
param4: 'xx',
param5: 'xx',
}
aParams: {
aone: '',
atwo: '',
athree: '',
afour: 'blablabla'
}
I was able to do it but not 100% good, I was able to split it to two objects but "advancedParams" got into the first object as a field also(which I don't him to be)