ng中自定义弹框

1.html

<div class="boostTipBox" ng-show="boostTipFlag">

    <div class="boostTip">{{boostTip}}</div>

  </div>

2. js

    function alertP(msg, time) {

          var t = time || 1000;
          $scope.boostTip = msg;
          $scope.boostTipFlag = true;
          var a = $timeout(function () {
              $scope.boostTipFlag = false;
              $timeout.cancel(a);
          }, t)

      }

3.css

 /*提示框的样式*/

.boostTipBox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
}
.boostTip {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto auto;
    width: 400px;
    height: 128px;
    line-height: 126px;
    text-align: center;
    border: 1px solid #dadada;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 0 10px #bbb;
}

猜你喜欢

转载自blog.csdn.net/web_cgh/article/details/80896668
今日推荐