Answer the question
In order to leave comments, you need to log in
How to access a specific button?
There are identical blocks of html code, for example:
<div *ngFor="let car of carsArray">
<div>
<!--тут какая-либо информация о машине-->
</div>
<div>
<button class="btn more-info-btn" (click)=showMore()>Подробнее</button>
</div>
<div *ngIf="needMore" class="additional-info">
<!--тут доп. информация показывается при нажатии на кнопку-->
</div>
</div>
showMore(){
this.needMore = !this.needMore
}
Answer the question
In order to leave comments, you need to log in
<div *ngFor="let car of carsArray; let showMore">
<div>
<!--тут какая-либо информация о машине-->
</div>
<div>
<button class="btn more-info-btn" (click)=showMore = !showMore>Подробнее</button>
</div>
<div *ngIf="needMore" class="additional-info">
<!--тут доп. информация показывается при нажатии на кнопку-->
</div>
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question