ionic 弹窗(alert, confirm)
直接上代码吧,不解释了
控制器:
angular.module('app.controllers', [])
.controller('categoryCtrl', ['$scope', '$http', '$stateParams','$ionicLoading','$ionicPopup',
function ($scope, $http, $stateParams, $ionicLoading, $ionicPopup) {
window.$ionicPopup = $ionicPopup; $scope.test = function(){
alert('什么鬼??', function(){
alert('神经病啊!', function(){
confirm('你的傻的么?', function(){
alert('看来是啊。');
}, function(){
show("<p style='text-align:center;'>你说你怎么不是傻的?</p><p><input type='text'></p>", {title:'你484傻的?', cancelText:'我承认了', okText:'我不是!', success:function(){
alert("唉哟,不错哦","好像有点道理wo~");
}});
});
});
});
}
}])
common.js:
function show(the_template, params){
var the_title = params.title || '';
var the_subtitle = params.subtitle || '';
var timeout = params.timeout;
var the_cancelText = params.cancelText || '取消';
var the_okText = params.okText || '确定'; var myPopup = window.$ionicPopup.show({
template: the_template,
title: the_title,
subTitle: the_subtitle,
buttons:[
{
text:the_cancelText,
onTap:function(){
return false;
}
},
{
text:the_okText,
type:'button-positive',
onTap:function(){
return true;
}
}
]
});
myPopup.then(function(res) {
if(res) {
if(params.success) params.success(res);
} else {
if(params.error) params.error(res);
}
}); if(timeout){
window.setTimeout(function(){
myPopup.close();
}, timeout);
}
} function alert(the_title, the_content, the_callback){
if(typeof(the_content)!='string'){
the_callback = the_content;
the_content = the_title;
the_title = '系统提示';
} if(typeof(the_content)!='string'){
the_callback = the_content;
the_content = the_title;
the_title = '系统提示';
} var alertPopup = window.$ionicPopup.alert({
title: the_title,
template: the_content,
okText: '确定'
}); alertPopup.then(function(res) {
if(the_callback) the_callback(res);
});
} function confirm(the_content, mixed, mixed2){
var params = {};
if(typeof(mixed)=='function'){
params.success = mixed;
params.error = mixed2;
}else{
params = mixed;
} if(!params.title) params.title = '请确认?';
show(the_content, params);
}
官方文档:http://ionicframework.com/docs/api/service/$ionicPopup/
ionic 弹窗(alert, confirm)的更多相关文章
- alert/confirm/prompt 处理
webdriver 中处理JavaScript 所生成的alert.confirm 以及prompt 是很简单的.具体思路是使用switch_to_alert()方法定位到alert/confirm/ ...
- 转:python webdriver API 之alert/confirm/prompt 处理
webdriver 中处理 JavaScript 所生成的 alert.confirm 以及 prompt 是很简单的.具体思路是使用switch_to.alert()方法定位到 alert/conf ...
- 2.11 alert\confirm\prompt
2.11 alert\confirm\prompt 前言 不是所有的弹出框都叫alert,在使用alert方法前,先要识别出到底是不是alert.先认清楚alert长什么样子,下次碰到了,就可以用 ...
- selenium自动化测试入门 Alert/Confirm/Prompt 弹出窗口处理
一.Alert/Confirm/Prompt弹出窗口特征说明 Alert弹出窗口: 提示用户信息只有确认按钮,无法通过页面元素定位,不关闭窗口无法在页面上做其他操作. Confirm 弹出窗口: 有确 ...
- 在Android的webview中定做js的alert,confirm和prompt对话框的方法
在Android的webview中定制js的alert,confirm和prompt对话框的方法 http://618119.com/archives/2010/12/20/199.html 1.首先 ...
- selenium python (十一)alert/confirm/prompt的处理(js中的弹出框)
webdriver中处理js所生成的alert.confirm以及prompt,采用switch_to_alert()方法定位到alert/confirm/prompt.然后使用text/accept ...
- Python脚本控制的WebDriver 常用操作 <二十二> 处理alert / confirm / prompt
测试用例场景 webdriver中处理原生的js alert confirm 以及prompt是很简单的.具体思路是使用switch_to.alert()方法定位到alert/confirm/prom ...
- Bootstrap Modal 框 alert confirm loading
/** * Created by Administrator on 2016/5/4. */ /** * 模态窗口 */ window.Modal = { tpls:{ alert:'<div ...
- 开发中少不了的Fun -- 微信开发IOS端alert/confirm提示信息,去除网址(URL)的方法
在微信公众号开发的时候在使用[alert/confirm]弹出提示或者警告信息的时候,[alert/confirm]会将该公众号的网址显示出来,这样很不美观.所以很多时候我们会选择去除那个网址提示内容 ...
- Fixed the bug:while running alert/confirm in javascript the chrome freezes
显示高级设置... 系统 -> 使用硬件加速模式(如果可用) 操作系统如果不支持硬件加速,却启动此项,就悲催了.小伙伴们可别瞎点了,太吃亏. 现象alert/confirm一执行,chrome ...
随机推荐
- 神经网络中 BP 算法的原理与 Python 实现源码解析
最近这段时间系统性的学习了 BP 算法后写下了这篇学习笔记,因为能力有限,若有明显错误,还请指正. 什么是梯度下降和链式求导法则 假设我们有一个函数 J(w),如下图所示. 梯度下降示意图 现在,我们 ...
- curl命令常用参数
-a/--append 上传文件时,附加到目标文件 -A/--user-agent <string> 设置用户代理发送给服务器 -anyauth 可以使用“任何”身份验证方法 -b/--c ...
- (Windows Maven项目)Redis数据库的安装和操作实现
Redis是一个内存数据库,他会把你写入当中的数据缓存到内存中,之后会周期性的往磁盘中写入.这篇文章中介绍的是在Windows环境下利用Maven工具编译运行Java文件实现Red ...
- 小程序 wx.request ajax示例
简单示例 https://developers.weixin.qq.com/miniprogram/dev/api/network-request.html wx.request({ method: ...
- sysbench的安装详解
sysbench是一个压力测试工具.可以用它来测试cpu.mem.disk.thread.mysql.postgr.oracle:然而作为一个mysql dba 我当然是用它来压测mysql啦! 一. ...
- docker 下 alpine 镜像设置时区的有效办法
在使用Docker的时候,由于很多基础linux镜像都比较大,alpine这个仅仅几兆的linux基础镜像受到了很多人喜欢,笔者也不例外,可是由于alpine中的一些配置及命令与常见的centos等系 ...
- Jquery easyUI datagrid载入复杂JSON数据方法
1.JSON数据为: { "total":28, "rows": [ { "itemNo": "1&q ...
- SCUT入门-协议生成器配置
协议生成器需要放在IIS里才能正常使用.具体目录在:Scut\Source\Tools\ContractTools\release 关于具体细节看这篇:https://github.com/ScutG ...
- 2014 Multi-University Training Contest 1/HDU4864_Task(贪心)
解题报告 题意,有n个机器.m个任务. 每一个机器至多能完毕一个任务.对于每一个机器,有一个最大执行时间Ti和等级Li,对于每一个任务,也有一个执行时间Tj和等级Lj.仅仅有当Ti>=Tj且Li ...
- 进程控制函数(3)-getsid()和setsid()获取当前会话和建立新会话
pid_t setsid(void) 1.调用进程不能是进程组组长,该进程变成新会话首进程(session header) 2.该进程成为一个新进程组的组长进程. 3.需有root权限(ubuntu不 ...