2

I know you can use the for:each directive to loop through Arrays, but is there some way to loop through an object's properties?

1
  • No, you need to convert that into an array. Apr 8 at 17:56

1 Answer 1

5

No, you cannot. However, it is pretty easy to do so with a getter:

get objectProperties() {
  return Object.entries(this.recordObject).map(([key,value])=>({ key, value }));
}

...

for:each={objectProperties} for:item="prop"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.