Как я этого добился
Шаг 1:
<button type="button" (click)="alterDescriptionText()">
{ showShortDesciption ? 'SHOW ALL': 'SHOW LESS' }}
</button>
Шаг 2: (In Your.Файл component.ts)
showShortDesciption = true
alterDescriptionText() {
this.showShortDesciption = !this.showShortDesciption
}
Шаг 3:
<div [ngClass]="{'show-less': showShortDesciption}">
<!-- Your Text Here -->
</div
Шаг 4:
.show-less {
height: 4rem;
overflow: hidden;
padding: 1rem;
}
В основном я изменяю высоту div при нажатии кнопки