I want to display this span
<span class="badge badge-danger">RARE</span>
only if this condition is true
listComics() {
this.comicsService.getComics().subscribe(
comicsList => {
this.comics = comicsList.data.results;
this.rareComic = comicsList.data.results[Math.floor(Math.random() * this.comics.length)];
for(var i = 0; i < this.comics.length; i++){
if(this.comics[i] == this.rareComic){
console.log(this.comics[i])
console.log(this.rareComic)
//Both are the same
}
}
});
}
I tried using *ngIf
and [hidden]
but no success.