I am developing one application where I am getting object from http request and converting it to itteratable array like this. When I run the app in development mode the code sometime runs and give random error like below. But when I do run ng build --prod, it always gives me the below error and I am stuck due to it.
Where I have missed anything?
Object.keys(res['com'][element]['schema']['properties']).forEach(inputKey => {
this.newfdata[element]['properties'].push(res['com'][element]['schema']['properties'][inputKey]);
}
// this is line no. 223
this.objectProps = Object.keys(res['com'][element]['schema']['properties']).map(prop => {
return Object.assign({}, { key: prop} , res['com'][element]['schema']['properties'][prop]);
// this is line no. 228
});
I got the below error due to above lines.
ERROR in src/app/shared/layout/add.component.ts(223,5): error TS1005: ',' expected.
src/app/shared/layout/add.component.ts(228,11): error TS1005: ')' expected.
Please help me. Because of this issue whole app is not getting into prod mode.
Thanks in advance.
You closed the forEach before closing of input key function , may be that is causing the error , change the line on top of line no.223 as i did below ,hope this will solve the issue.
Object.keys(res['com'][element]['schema']['properties']).forEach(inputKey => {
this.newfdata[element]['properties'].push(res['com'][element]['schema']['properties'][inputKey]
}); // close forEach
// this is line no. 223
this.objectProps = Object.keys(res['com'][element]['schema']['properties']).map(prop => {
return Object.assign({}, { key: prop} , res['com'][element]['schema']['properties'][prop]);
// this is line no. 228
});