问题
I am looking to set an ionic button's state to active, but this isn't documented at all in the API docs. As of right now, when you click the button, the "activated" class is added to the button, and then removed a few moments later.
回答1:
This can be done via [ngClass]="{'activated' : YourVariableHere }"
HTML:
<button class="post-button" [ngClass]="{'activated' : buttonActive}"ion-button outline small icon-left">
Component code:
buttonActive: boolean = true;
来源:https://stackoverflow.com/questions/47957040/ionic-button-activated-active