直接上代码吧,不解释了

控制器:

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)的更多相关文章

  1. alert/confirm/prompt 处理

    webdriver 中处理JavaScript 所生成的alert.confirm 以及prompt 是很简单的.具体思路是使用switch_to_alert()方法定位到alert/confirm/ ...

  2. 转:python webdriver API 之alert/confirm/prompt 处理

    webdriver 中处理 JavaScript 所生成的 alert.confirm 以及 prompt 是很简单的.具体思路是使用switch_to.alert()方法定位到 alert/conf ...

  3. 2.11 alert\confirm\prompt

    2.11 alert\confirm\prompt 前言   不是所有的弹出框都叫alert,在使用alert方法前,先要识别出到底是不是alert.先认清楚alert长什么样子,下次碰到了,就可以用 ...

  4. selenium自动化测试入门 Alert/Confirm/Prompt 弹出窗口处理

    一.Alert/Confirm/Prompt弹出窗口特征说明 Alert弹出窗口: 提示用户信息只有确认按钮,无法通过页面元素定位,不关闭窗口无法在页面上做其他操作. Confirm 弹出窗口: 有确 ...

  5. 在Android的webview中定做js的alert,confirm和prompt对话框的方法

    在Android的webview中定制js的alert,confirm和prompt对话框的方法 http://618119.com/archives/2010/12/20/199.html 1.首先 ...

  6. selenium python (十一)alert/confirm/prompt的处理(js中的弹出框)

    webdriver中处理js所生成的alert.confirm以及prompt,采用switch_to_alert()方法定位到alert/confirm/prompt.然后使用text/accept ...

  7. Python脚本控制的WebDriver 常用操作 <二十二> 处理alert / confirm / prompt

    测试用例场景 webdriver中处理原生的js alert confirm 以及prompt是很简单的.具体思路是使用switch_to.alert()方法定位到alert/confirm/prom ...

  8. Bootstrap Modal 框 alert confirm loading

    /** * Created by Administrator on 2016/5/4. */ /** * 模态窗口 */ window.Modal = { tpls:{ alert:'<div ...

  9. 开发中少不了的Fun -- 微信开发IOS端alert/confirm提示信息,去除网址(URL)的方法

    在微信公众号开发的时候在使用[alert/confirm]弹出提示或者警告信息的时候,[alert/confirm]会将该公众号的网址显示出来,这样很不美观.所以很多时候我们会选择去除那个网址提示内容 ...

  10. Fixed the bug:while running alert/confirm in javascript the chrome freezes

    显示高级设置... 系统  -> 使用硬件加速模式(如果可用) 操作系统如果不支持硬件加速,却启动此项,就悲催了.小伙伴们可别瞎点了,太吃亏. 现象alert/confirm一执行,chrome ...

随机推荐

  1. ASP.Net中后台控制页面提示信息的显示方式

    ASP.Net中后台控制页面提示信息的显示方式   用于删除或修改成功后的显示:(背景No空白) ScriptManager.RegisterStartupScript(this, typeof(Pa ...

  2. js日期控件

    My97日期控件 官方网站 My97 Datepicker Home   http://www.my97.net/

  3. 连载:面向对象葵花宝典:思想、技巧与实践(35) - NOP原则

    NOP.No Overdesign Priciple.不要过度设计原则. 这应该是你第一次看到这个原则.而且你也不用上网查了,由于这个不是大师们创造的,而是我创造的:) 之所以提出这个原则,是我自己吃 ...

  4. hive 分位数函数 percentile(col, p)

    注意在偶数情况下,中位数会存在小数,特别注意! hive里面倒是有个percentile函数和percentile_approx函数,其使用方式为percentile(col, p).percenti ...

  5. java web中get请求中文乱码在filter中解决

    之前已经讲过get或者post方法的中文乱码问题,之前都是在每个方法中编写设置编码.如果程序变大,就会很繁琐,使用filter可以避免这种繁琐. 1)写一个encodingFilter进行编码设置 p ...

  6. laravel路由之分组路由

    laravel下的分组路由可以嵌套如下: Route::group(['prefix'=>'admin'],function(){ Route::group(['prefix'=>'dtk ...

  7. cocos2dx, 重新initWithSpriteFrameName与重新setTexture()+setTextureRect()区别

    比如我们有一个sprite是通过createWithSpriteFrameName创建的,现在我们需要为其更换贴图,有两种方法: 一种方法是再次调用createWithSpriteFrameName, ...

  8. spine 所有动画的第一帧必须把所有能K的都K上

    spine 所有动画的第一帧必须把所有能K的都K上.否则在快速切换动画时会出问题.

  9. 利用ngModel相关属性及方法自定义表单验证指令

    这是一个只能输入偶数的验证指令

  10. cnblogs博客迁移到hexo

    cnblogs博客备份 备份地址:https://i.cnblogs.com/BlogBackup.aspx?type=1 备份文件为xml格式,打开备份文件,如下所示: <?xml versi ...