mira tengo el siguient emetodo, "bort(index, indexType,type){ console.log(index,…
- User
mira tengo el siguient emetodo, "bort(index, indexType,type){ console.log(index, indexType, type);
const formArray = this.getVehiclesServicesForm(type); const formGroup = formArray.at(index) as FormGroup; if (!this.listaditionals[type]) { this.listaditionals[type] = []; // Inicializa el arreglo si no existe } // Asegúrate de que el índice dentro del tipo esté inicializado if (!this.listaditionals[type][index]) { this.listaditionals[type][index] = []; // Inicializa el objeto en el índice si no existe } if (!this.listAddServices[type][index][indexType]) { this.listAddServices[type][index][indexType] = { value: 0, desc: '' }; } const price = formGroup.get('price').value; const quantity = this.getVehiclesForm(type).value[index].quanty; this.listaditionals[type][index][indexType] = {desc : `$ ${price} x ${quantity}`, value: price * quantity};}" sin embargo me esta saliendo el error ":Cannot set properties of undefined (setting '0') logging.service.ts:12 Error❌:TypeError: Cannot set properties of undefined (setting '0') at NewContractComponent.bort (new-contract.component.ts:740:36) at NewContractComponent_div_119_div_1_div_5_div_1_div_19_Template_input_input_4_listener (new-contract.component.html:405:76) at executeListenerWithErrorHandling (core.mjs:15116:1) at wrapListenerIn_markDirtyAndPreventDefault (core.mjs:15160:1) at HTMLInputElement. (platform-browser.mjs:466:38) at _ZoneDelegate.invokeTask (zone.js:406:1) at Object.onInvokeTask (core.mjs:25681:1) at _ZoneDelegate.invokeTask (zone.js:405:1) at Zone.runTask (zone.js:178:1) at ZoneTask.invokeTask [as invoke] (zone.js:487:1)" en esta linea "if (!this.listAddServices[type][index][indexType]) {" me puedes ayudar por favor
- Assistant