How to return an array after a function?

Discussão em 'Angular' iniciado por GustavoA, Novembro 2, 2024.

  1. GustavoA

    GustavoA Guest

    I manage to make my array to work on the console.

    When I click the button the array shows on the console, but not on my HTML.

    TS:

    jogar(){
    for(var u=0;u<6;u++){
    this.y = Math.ceil(Math.random()*59+1);
    this.random.push(this.y);
    };
    };


    HTML:

    <ion-card-content>
    <button ion-button color="secondary" (click)="jogar()">Jogar</button>
    <p>{{random}}</p>
    </ion-card-content>


    How can I make it work?

    Continue reading...

Compartilhe esta Página