直接上代码吧,不解释了

控制器:

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. iOS多线程常用类说明

    iOS的多线程,涉及到如下一些类,这里集中做个介绍,免得混淆. 1.NSTimer 很显然,这是定时器类 2.NSTask iOS 不支持 NSTask 在很多并发操作的时候,多线程太耗资源,也太危险 ...

  2. Mybatis自动生成的配置实例

    一.目录 按照图片准备下面的东西吧,基础jar,数据链接库的jar. 二.generatorConfig.xml <?xml version="1.0" encoding=& ...

  3. GridControl摘录

    gvCabTotalInfo.Columns["出线平均<br>电压"].SummaryItem.SummaryType = DevExpress.Data.Summa ...

  4. ICSharpCode.SharpZipLib工具压缩与解压缩zip文件

    using System; using System.Collections.Generic; using System.IO; using System.Text; using ICSharpCod ...

  5. C#设置文件夹用户权限

    var security = new DirectorySecurity();   string path=@"C:\temp" //设置权限的应用为文件夹本身.子文件夹及文件,所 ...

  6. JavaScript:Object.prototype.toString进行数据类型判定

    在JavaScript中,想要判断某个对象值属于哪种内置类型,最靠谱的做法就是通过Object.prototype.toString方法. var arr = []; console.log(Obje ...

  7. vim中不同模式的帮助信息的查找

    vim的模式有多种,比如normal(普通模式),insert(插入模式),command(命令行模式),visual(可视化模式).相同的命令和快捷键在不同的模式下功能是不一样的,因此帮助信息也是分 ...

  8. Memcached安装以及PHP的调用

    Memcached安装以及PHP的调用 [南京·10月17日]OSC源创会开始报名:Swift.大型移动项目构架分享 » 一:安装libevent 由于memcached安装时,需要使用libeven ...

  9. vue2.0实现图片加载失败默认显示图片

    <div class="bg"> <img :src="goods.phoneFloorAd.resUrl" :onerror="e ...

  10. JDK默认使用的垃圾回收器

    查看方法java -XX:+PrintCommandLineFlags -version 引用<深入理解Java虚拟机:JVM高级特性与最佳实践>的介绍: 所以,jdk8环境下,默认使用 ...