Call function without a event?

Hello, i need to call a function without an event. In each item of the ngFor i need to call function “Detalles” with the param “Item”. How i can do this?.Thanks for the time

<ion-list-header *ngFor="let item of departamento"  >{{ item.nombre_departamento }} ({{ item.capacidad }})
      <ion-item (event?)="Detalles(item)" *ngFor="let detalle of detalles">
          {{ detalle.FECHA}}
      </ion-item>
    </ion-list-header>

Why don’t you call Detalles in the controller?

Because in each of the “Items” I have a primary key, which is linked to a table in MySQL. For each one of them I send this primary key and I get rows in which I would cross them with the other ngFor

Replace the term (event?) with (click)

Yes, but i need to this do when i open the page. Without a event. When NgFor works, I want to send that function with the item

You are thinking backward. Don’t have the template do the work. The controller (ts file) does the work, and the template displays it after the work is done. Bind your ngFor to an array that has already been processed. Don’t bind the ngFor to a raw Observable from an exterior source.

3 Likes

And use ionic lifecycle hooks to do sonthing after the view completed

DId you got any solution for this?
Please let me know if you find any! Thanks

Please describe what you are actually trying to do as if you are speaking to somebody who has never even heard of Ionic or JavaScript. I strongly suspect you have XYed yourself down a rabbit hole of bad design.