直接上代码吧,不解释了

控制器:

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. 超级干货,python常用函数大总结

    我们在学习python的时候,接触最多的往往则是那些函数,对于python函数,在这里为大家总结归纳了这些,如果有缺漏,还请及时留言指正哦! 话不多说,干货来袭! 1.常用内置函数:(不用import ...

  2. C#指南,重温基础,展望远方!(9)C#接口

    接口定义了可由类和结构实现的协定. 接口可以包含方法.属性.事件和索引器. 接口不提供所定义的成员的实现代码,仅指定必须由实现接口的类或结构提供的成员. 接口可以采用多重继承. 在以下示例中,接口 I ...

  3. Windows Mobile自动更新

    private static string m_CurrentPath; //取得作业平台 private static string Platform { get { return Environm ...

  4. EasyUI combobox的panelHeight自动高度

    在使用EasyUI的时候,有时会用到combobox组件,这里的记录数不是很固定,设置为auto可能会被挡住,设置固定高度时,option很少时,也很丑 所以这里给出我自己自动调整combobox的p ...

  5. maven ArtifactTransferException:failure

    手动下载对应jar放在本地仓库 -> Update Dependencies(Maven4Myeclipse:eclipse上maven插件)

  6. 交叉编译Node.js到OpenWrt(HG255D)

    操作系统:deepin linux 2013 或 ubuntu 13.04 1.安装交叉编译前.须要安装的包 sudo apt-get install build-essential subversi ...

  7. atitit.orm的缺点与orm框架市场占有率,选型attilax总结

    atitit.orm的缺点与orm框架市场占有率,选型attilax总结 1. attilax的orm框架要求 1 2. orm框架市场占有率 2 3. spring jdbc templt 3 4. ...

  8. 632. Binary Tree Maximum Node【Naive】

    Find the maximum node in a binary tree, return the node. Example Given a binary tree: 1 / \ -5 2 / \ ...

  9. spring oauth2相关资料

    理解OAuth 2.0  *****http://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html Secure REST API with oauth2 ...

  10. Debian8.0 搭建leanote

    参考了官方wiki以及中文博客 https://github.com/leanote/leanote/wiki http://leanote.leanote.com/post/Leanote-manu ...