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 ...
随机推荐
- Python 3.x 连接 pymysql 数据库
首先,需要安装库: 使用 pycharm IDE,如PyCharm,可以使用 project python 安装第三方模块. [File] >> [settings] >> [ ...
- 简述document.write和 innerHTML的区别。
document.write是重写整个document, 写入内容是字符串的htmlinnerHTML是HTMLElement的属性,是一个元素的内部html内容
- ubuntu 命令行下查看网页 w3m
w3m localhost/index.php
- django Models cross file ---- 跨app引用文件
一.django 的跨app引用文件是通过import 来实现的,但是import 的路径查找和标准的import 不太一样,django里面更加方便了 二.例子 1.project 结构说明 [ji ...
- Atitit.软件仪表盘(2)--vm子系统--资源占用监测
Atitit.软件仪表盘(2)--vm子系统--资源占用监测 1. Jvisualvm.exe 2. jprofile 3. Heap //permgen monitor 作者::老哇的爪子At ...
- Java 之进制转换
//十进制转十六进制 import java.util.Scanner; public class Main{ public static void main(String[] args){ Scan ...
- 如何在Windows下面运行hadoop的MapReduce程序
在Windows下面运行hadoop的MapReduce程序的方法: 1.下载hadoop的安装包,这里使用的是"hadoop-2.6.4.tar.gz": 2.将安装包直接解压到 ...
- JDK默认使用的垃圾回收器
查看方法java -XX:+PrintCommandLineFlags -version 引用<深入理解Java虚拟机:JVM高级特性与最佳实践>的介绍: 所以,jdk8环境下,默认使用 ...
- 纯css3实现的鼠标悬停动画按钮
今天给大家带来一款纯css3实现的鼠标悬停动画按钮.这款按钮鼠标经过前以正方形的形式,当鼠标经过的时候以动画的形式变成圆形.效果图如下: 在线预览 源码下载 实现的代码. html代码: < ...
- HTTP Header Accept-Language的ctf
题目也不知道该怎么取,但是是实在的一个案例.分享给大家. 种族歧视分值: 300 小明同学今天访问了一个网站,竟然不允许中国人访问!太坑了,于是小明同学决心一定要进去一探究竟! 发现accept-L ...