'Angular translate toggle button text dynamically
I have this toggle that expands text which i would like to have in two languages. Normally i use | translate and i add the translated text in json files (i18n), but this time it doesn´t work. Could i solve this with *ngIfs? TIA.
Here is my code:
<div (click)="showMore()">
<span class="cursorPointer material-icons align-text-bottom"> {{ !isReadMore ? 'keyboard_arrow_down': 'keyboard_arrow_up' }}</span>
<span *ngIf="">{{ isReadMore ? 'lang1': 'lang2' }}</span>
<span *ngIf="">{{ isReadMore ? 'lang1': 'lang2' }}</span>
</div>
Solution 1:[1]
{{ (!isReadMore ? 'keyboard_arrow_down': 'keyboard_arrow_up') | translate }}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | dopoto |
