I want to switch between 2 values in a class.
Something like this,
<ion-item *ngFor="let part of partner" class="border_bottom bdr_radius">
<p class="font_c_2 gra_reg" #short (click)="onShowHide(short)" [ngStyle]="{'white-space': whiteSpace}">
{{part.fsp_partner_location}}
</p>
</ion-item>
public onShowHide(controlToShow) {
this.render.setStyle(controlToShow, white-space=='normal' ? 'nowrap' : 'normal');
}
Above code is throwing an error: "white is not defined"
I know my format is not correct, any help will be appreciated.
Thanks
Now when I know your code this is what I will do :
HTML part:
css part:
your ts file:
When you click on item it will set
normal
for it and others willhave
nowrapTry this one
To do it on click event, just set and event handler and pass the control. then chech which is your current class and apply the logic you want to apply a new one
Demo here
HTML
TS
Otherwise, use the one of the other answers