Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
angular-popups
Advanced tools
基于 AngularJS 的浮层组件,由 artDialog 演进而来。angular-popups 是一个严格遵循 AngularJS 架构与 web 标准的组件:
ng-if
、ng-show
、ng-hide
控制浮层的显示、销毁$event
)对齐演示站点:https://aui.github.io/angular-popups/
支持使用 script 标签或者 webpack、requirejs、seajs 调用:
调用
<script src="lib/angular.js"></script>
<script src="dist/angular-popups.js"></script>
<script>
var app = angular.module('app', ['angular-popups']);
</script>
安装
npm install angular-popups
调用
require('angular-popups');
var app = angular.module('app', ['angular-popups']);
angular-popups 依赖
angular
这个全局模块
包含如下浮层指令:
名称 | 说明 |
---|---|
ng-if | 显示或隐藏浮层(DOM 插入或删除) |
ng-show | 显示浮层 |
ng-hide | 隐藏浮层 |
for | 指定元素对齐,传入目标元素 ID 即可 |
align | 对齐的参数,此参数需要与 for 配合使用。默认 "bottom left" ,可选值:"top left" "top" "top right" "right top" "right" "right bottom" "bottom right" "bottom" "bottom left" "left bottom" "left" "left top" |
fixed | 使用固定定位,等同于 CSS position:fixed |
modal | 模态浮层 |
duration | 自动关闭的时间(单位毫秒) |
close | 浮层关闭事件 |
close-action | 配置浮层由什么动作来触发关闭(执行 close 事件)。默认 "esc timeout" ,所有支持的动作: "esc timeout outerchick click" |
ng-if
、ng-show
如果传入的是$event
,则浮层会定位到事件触发位置
对话框指令
名称 | 说明 |
---|---|
dialog-title | 对话框标题容器 |
dialog-content | 对话框内容容器 |
dialog-buttons | 对话框按钮容器 |
dialog-statusbar | 对话框状态栏容器 |
对话框子指令中的事件可以使用
$close()
这个函数,它会调用通用参数close
中的表达式
<dialog ng-if="dialog.open" close="dialog.open=false">
<div dialog-title>消息</div>
<div dialog-content>hello world</div>
</dialog>
在线演示:
气泡浮层指令
<button id="btn" ng-click="bubble.open = true">打开气泡</button>
<bubble ng-if="bubble.open" for="btn" close="bubble.open=false">
hello world
</bubble>
在线演示:
通知消息指令
<notice ng-if="notice.open" duration="2000" close="notice.open=false">
hello world
</notice>
在线演示:
透明浮层指令
无任何样式,可以用来制作自定义形状的浮层
<popup ng-if="popup.open" close="popup.open=false">
<div class="mod-popup-example">hello world</div>
</popup>
在线演示:
若想在 js 代码中调用浮层相关控件,可以使用 Popup
服务。
Popup
服务仅支持文本消息,HTML 内容请使用指令
配置默认的标题以及按钮文案
app.config(function (PopupProvider) {
PopupProvider.title = '提示';
PopupProvider.okValue = '确定';
PopupProvider.cancelValue = '取消';
});
app.controller('testCtrl', function($scope, Popup) {
Popup.alert('hello world', function () {
console.log('ok');
});
});
在线演示:
喜欢这个项目?捐助一杯咖啡支持下(¥28)
FAQs
基于 AngularJS 的浮层组件
We found that angular-popups demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.