如何在离子按钮点击时更改事件?

时间:2018-09-24 09:25:23

标签: ionic2

我希望当我单击按钮时,文本将更改为“不喜欢”或更改诸如facebook之类的文本的颜色,再次单击该按钮时,文本的颜色将更改为或将标题更改为“喜欢”?

 <div class="like-info-icon" *ngIf="ionicNamedColor == true">
        <button (click)="toggleNamedColor($event)" color="primary" block>
            <img src="assets/imgs/like.png">
       </button>
    </div>
    <div class="like-info-icon" *ngIf = "ionicNamedColor == false">
      <button (click)="toggleNamedColor($event)" color="primary" block>
          <img src="assets/imgs/comments1.png">
     </button>
  </div>
    <div class="like-info-content GuardianEgyp-Light-Web">
      <p item-end><span>{{robot.TotalLikesId}}</span> Likes</p>
  </div>



  public toggleNamedColor(): void {
    this.ionicNamedColor = false;
}

我不知道该怎么办,请提出一些想法或任何解决方案? 谢谢

0 个答案:

没有答案