I have the following result from database (using sequelize), the result:
JSON from the database:
[{"codSparePart":"SP001","name":"NAME","description":"DESCRIPTION","codProject":1,"available":1,"codManufacturer":1,"stock":4,"manufacturer.name":"MAN1","manufacturer.description":"DES1","manufacturer.codManufacturer":1}]
In the controller I do the next:
vm.spareParts = data.data;
console.log('-------- ' + JSON.stringify(vm.spareParts));
for (var i = 0; i < vm.spareParts.length; i++) {
vm.items.push({
codSparePart: vm.spareParts[i].codSparePart,
name: vm.spareParts[i].name,
description: vm.spareParts[i].description,
available: vm.spareParts[i].available,
codManufacturer: vm.spareParts[i].codManufacturer,
nameManufacturer: vm.sparePart[i]['manufacturer.description'],
stock: vm.spareParts[i].stock,
codProject: vm.spareParts[i].codProject
});
All is working perfectly except in reading the variables with dot.
nameManufacturer: vm.sparePart[i]['manufacturer.description']
nameManufacturer: vm.sparePart[i]['manufacturer.name']
How can I read these variables, I'm looking for the solution but I think is too simple and there is not any information about it. Thanks in advance for your help.