微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

模态按钮以角度显示图像

如何解决模态按钮以角度显示图像

在我的项目中,我想在单击按钮时显示图像。如何在(单击)上配置 openModal() 方法来执行此操作?

IMG 取自 assets 目录,并根据您的代码(B1、B2)选择进行更改。

<!-- OPERATION -->
  <div class="card my-5">
    <div class="card-header" style="text-align: center; font-size: 20px;">
      <p><strong>Operation</strong></p>
    </div>
    <div class="card-body">
      <form>
        <div class="form-group">
          <tr *ngFor="let arr of varOperation; index as i">
            <td>
              Code: {{arr.operation.code}}
              - {{arr.operation.description}}
            </td>
            <button style="margin-left: 20px; float: right;" class="btn btn-primary" (click)="viewCodeOperation(arr.operation.code)" (click)="openModal()">
              Go
            </button>
          </tr>
        </div>  
      </form> 
    </div>
  </div>

  <!-- IMAGES -->
  <div class="overflow-auto">
    <div *ngIf="imgB1">
      <img src="assets\images\B1.jpg">
    </div>

    <div *ngIf="imgB2">
    <img src="assets\images\B2.jpg">
    </div>
  </div>

viewCodeOperation(code: string) {
    this.imgB1 = false
    this.imgB2 = false

    console.log(code)
    if(code == "B1"){
      this.imgB1 = true
    }
    else if(code == "B2"){
      this.imgB2 = true
    }
}

  openModal() {
  }

解决方法

您可以尝试使用 https://github.com/maximelafarie/ngx-smart-modal 这样的库来设置 angular 模式。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。