Alrighty. So I am trying to create a mechanism of recording how many times a song is being played. So visually, I am clicking on each song, but the plays variable does not increment with each click.
Here is the TypeScript:
plays: number = 0;
addPlay(song){
song.plays = 0;
song.plays++;
}
And the HTML:
<ul> <!-- Each song on the album -->
<li class="song-block"
*ngFor='let song of songsToDisplay'
(click)="getSong(song)"
(mouseenter)="song.thumbsVisible=true"
(mouseleave)="song.thumbsVisible=false">
<div class="song-card"
(click)="addPlay(song)">
<p *ngIf="!song.isPlaying"
class="song-number">{{song.tracknumber}}</p>
<i *ngIf="song.isPlaying" class="fa fa-play fa-lg"></i>
<p class="song-name">{{song.name}}</p>
<p class="song-length">{{song.length}}</p>
<div class="thumbs"
*ngIf="song.thumbsVisible"> <!-- Thumbs section -->
<i class="fa fa-thumbs-up fa-lg" [ngClass]="selected"
(click)="thumbs(song)"
>
</i>
<i class="fa fa-thumbs-down fa-lg" [ngClass]="selected"
(click)="thumbs(song)"
>
</i>
</div>
<p class="plays">{{song.plays}}</p> <---- PLAYS
<svg class="explicit"
*ngIf="albumToDisplay.isExplicit === 'true'"
viewBox="0 0 24 24"
preserveAspectRatio="xMidYMid meet"
focusable="false">
<g class="style-scope iron-icon">
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4 6h-4v2h4v2h-4v2h4v2H9V7h6v2z"></path></g></svg>
</div>
</li>
</ul>