加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – Angular UI Bootstrap Alert Closable Issue

发布时间:2020-12-17 17:31:44 所属栏目:安全 来源:网络整理
导读:我使用 Angular UI Bootstrap生成警报框,使用以下代码: alert data-ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)"{{alert.msg}}/alert 它按预期呈现: 我的问题是:是否有某种方法可以将某些通知关闭,而其他通知则根据变
我使用 Angular UI Bootstrap生成警报框,使用以下代码:

<alert data-ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</alert>

它按预期呈现:

我的问题是:是否有某种方法可以将某些通知关闭,而其他通知则根据变量?

我编写了这个模拟代码,并且只在closeable为true时才显示可关闭的x.

$scope.alerts = [
    { type: 'danger',closeable: false,msg: 'Oh snap! Change a few things up and try submitting again.' },{ type: 'success',closeable: true,msg: 'Well done! You successfully read this important alert message.' },{ type: 'warning',msg: 'Be careful! Something may go wrong here.' },{ type: 'info',msg: 'Attention! Here is some news for you.' }
];

解决方法

试试你的十字架

<button type="button" class="close" data-dismiss="alert" ng-if="alert.closable">
<span aria-hidden="true">&times;  </span><span class="sr-only">Close</span></button>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读