0

I'm having some problem in deleting the array items based on two property values..

If we compare to classic Sql delete command, What I have to do is something like this:

DELETE oImages WHERE idOffertRow = 1 and idProductImage = 2

I don't know how to convert this sql example command in typescript.

This is that I'm ttrying to do but it doesn't work:

this.oImages = this.oImages.filter(function (obj) {
          return obj.idOffertRow !== oRow.idOffertRow && obj.idProductImage !== i.idProductImage;
        });

Thanks to support

1 Answer 1

1
this.oImages = this.oImages.filter(obj => idOffertRow !== 1 || idProductImage !== 2);

Filter is about keeping, not deleting. So invert your condition. With De Morgan's law, it gives

A . B ---> !A + !B
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.