0
I have two repetition structures that go through my element and check if the attribute "idatributo" is null.
If my object has two elements, only the first tribute is being printed. The second is null, I made a validation to reset the object if id is null.
I tried something like:
for(let i=0;i<this.variacaoForm.value.variacoes.length;i++){
for(let j=0;j<this.variacaoForm.value.variacoes[i].atributo.length;j++){
console.log("idatributo: "+this.variacaoForm.value.variacoes[i].atributo[j].idatributo)
if(this.variacaoForm.value.variacoes[i].atributo[j].idatributo == null){
console.log('entrou na condicao');
}
}
}
Not entering the if condition.
My object:
variacoes: (2) […]
0: {…}
atributo: (1) […]
0: {…}
idatributo: 5
1: {…}
atributo: {…}
idatributo: null
In short, I have two variations, within the variations I have an attribute, in one of these attributes I have null tribute, I would like my object (attribute) to be reset in this condition.
If I change the id of the second attribute it prnita normally, the problem is that the condition is not being made