conditionally add property to the angular element code example
Example: conditionally add key to object javascript
const condition = getCondition();
const additionalCondition = getAdditionalCondition();
const person = {
firstName: "Max",
...(condition && { lastName: "" }),
...(additionalCondition && { addition: "" }),
};