使用 angularjs 禁用弹出窗口的背景而不使用 bootstrap

Disabling back ground of the popup using angularjs without using bootstrap

我想仅使用 div、ng-class、ng-style 和 css3 样式来禁用弹出窗口和背景屏幕。我不想使用 BOOTSTRAP 模式。我一直在努力完成这项工作。我正在尝试显示和隐藏弹出窗口,但它所做的只是在不显示弹出窗口的情况下禁用屏幕。下面是代码

Html代码

<div id="popupBackGround" class="popupModal-backdrop" ng-if="newUser===true" ng-style="{'display': (newUser===false || newUser===undefined) ? 'none':'block'}">
<div id="popupBackGroundDialog" class="popupModal-dialog">
    <div class="popupModal-content">
        <div class="popupModal-body">
           <p style="margin-left: 20px;">
                            <strong>Is this user transferring from another Dept?</strong>
           </p>
           <p style="margin-left: 40px;">
                <input ng-click="" name="transfer" value="Yes" type="radio"> <strong>Yes</strong>
           </p> 
           <p style="margin-left: 40px;">
                <input ng-click="" name="transfer"  value="No" type="radio"> <strong>No</strong>
          </p>
          <p align= "center">
          <button class="btn btn-primary" ng-click="ok()">OK</button>
          </p>
        </div>                          
    </div>
</div>
</div>

CSS代码

.popupModal-dialog {
  position: absolute;
  width: 40%;
  margin-left: 400px;
  margin-right: 400px;
  margin-top: -430px;
  opacity: "0"
}
.popupModal-content {
  position: relative;
  background-color: #ffffff;
  border: 1px solid #999999;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
  background-clip: padding-box;
  outline: none;
}
.popupModal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  background-color: #000000;
  display: none;
  opacity: 0.5;
  filter: alpha(opacity=50);
}
.popupModal-body {
  position: relative;
  padding: 20px;
} 

如有任何帮助,我们将不胜感激

我会稍微简化一下——您似乎有两种机制执行相同的工作(ng-ifng-style)。

<div ng-app>
  <button ng-click="showModal=1">Show modal</button>

  <div id="popupBackGround" class="popupModal-backdrop" ng-if="showModal"></div>

  <div id="popupBackGroundDialog" class="popupModal-dialog" ng-show="showModal">
    <div class="popupModal-content">
      <div class="popupModal-body">
        <p style="margin-left: 20px;">{{showModal}}</p>
        <p>
          <button ng-click="showModal=0">Hide modal</button>
        </p>
      </div>
    </div>
  </div>
</div>

Demo

我也简化了您的 CSS。