【问题标题】:Display alert message pop up the to the user when user checked or unchecked the checkbox using angular当用户使用角度选中或取消选中复选框时,向用户显示警报消息
【发布时间】:2022-01-14 06:27:33
【问题描述】:

场景 1:用户最初检查了“Automated”的值并将该值更新为未选中状态 如果以下至少一个手风琴处于“已完成”状态,则会向用户弹出警报消息。

【问题讨论】:

  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: javascript html css angular typescript


【解决方案1】:

HTML
<div class="col-md-12 col-sm-12 filter-opn">
   <form #checkboxfilt="ngForm" (ngSubmit)="onapplyfilter(checkboxfilt)">
    <div > 
       <div>
          <input  type="checkbox"   name="Success" value="1" ngModel selected  ><br>
          <label for="Success"> Success</label><br>
       </div>
        <div>
          <input type="checkbox"   name="Pending" value="2" ngModel ><br>
           <label for="Pending"> Pending</label><br>
        </div>
        <div>
          <input type="checkbox"   name="Canceled" value="3" ngModel ><br>
          <label for="Canceled"> Canceled</label><br>
       </div>
                           
       <input type="submit" value="Apply">
        <br>
    </div>
  </form>
</div>

TS

onapplyfilter(checkbox:NgForm){

if((checkbox.value.Success ==''|| checkbox.value.Success==false) 
        &&(checkbox.value.Pending ==''|| checkbox.value.Pending==false)
        &&(checkbox.value.Canceled ==''|| checkbox.value.Canceled==false))
        {
            alert('CheckBox is Empty');
        }
  }


}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-07
    • 1970-01-01
    • 1970-01-01
    • 2017-01-24
    • 1970-01-01
    • 2016-09-30
    • 1970-01-01
    • 2016-04-20
    相关资源
    最近更新 更多