[SOLVED] Accessing ngFor loop object inside html element tag

Hello all,

I’m trying to access the ngFor loop variable in my template inside an html element

in this case.
How can I do this?

I’m doing the following:

<ion-card *ngFor="#entry of feed">
   ...
   <ion-card-content>
      <p class="post-message" data-postid="{{entry.posts[0].id}}">
         {{entry.posts[0].message}}
      ...
   ...
</ion-card-content>

In the element declaration

if I put the {{entry}} I cannot get anything… Whole app freezes.
How can I access that value?

Will keep searching and trying and if I found anything will post here.
Thanks

Got It!

We should do it this way:
[attr.data-postid]="entry.posts[0].id"

:wink: