Ionic弹窗服务允许程序创建、显示弹出窗口,需要用户继续响应。

弹窗系统支持更多灵活的构建alert()prompt()confirm()功能版本,以及用户习惯,除了允许查看完全自定义内容的的弹窗。

angular.module('mySuperApp', ['ionic'])
.controller(function($scope, $ionicPopup, $timeout) { // 触发一个按钮点击,或一些其他目标
$scope.showPopup = function() {
$scope.data = {} // 一个精心制作的自定义弹窗
var myPopup = $ionicPopup.show({
template: '<input type="password" ng-model="data.wifi">',
title: 'Enter Wi-Fi Password',
subTitle: 'Please use normal things',
scope: $scope,
buttons: [
{ text: 'Cancel' },
{
text: '<b>Save</b>',
type: 'button-positive',
onTap: function(e) {
if (!$scope.data.wifi) {
//不允许用户关闭,除非他键入wifi密码
e.preventDefault();
} else {
return $scope.data.wifi;
}
}
},
]
});
myPopup.then(function(res) {
console.log('Tapped!', res);
});
$timeout(function() {
myPopup.close(); //由于某种原因3秒后关闭弹出
}, 3000); // 一个确认对话框
$scope.showConfirm = function() {
var confirmPopup = $ionicPopup.confirm({
title: 'Consume Ice Cream',
template: 'Are you sure you want to eat this ice cream?'
});
confirmPopup.then(function(res) {
if(res) {
console.log('You are sure');
} else {
console.log('You are not sure');
}
});
}; // 一个提示对话框
$scope.showAlert = function() {
var alertPopup = $ionicPopup.alert({
title: 'Don\'t eat that!',
template: 'It might taste good'
});
alertPopup.then(function(res) {
console.log('Thank you for not eating my delicious ice cream cone');
});
};
};
});

原文出处:http://www.ionic.wang/js_doc-index-id-52.html

Ionic 弹出窗的更多相关文章

  1. Jquery和Javascript 实际项目中写法基础-弹出窗和弹出层 (4)

     一.实际项目中有很多如下界面效果.    二.该效果可以归结为弹出窗或者弹出层来实现的,为什么这么说?看如下代码:      <!DOCTYPE html> <html> & ...

  2. Bootstrap模态弹出窗

    Bootstrap模态弹出窗有三种方式: 1.href触发模态弹出窗元素: <a class="btn btn-primary" data-toggle="moda ...

  3. jquery Mobile弹出窗

    先创建一个窗体 <div data-role="popup" id="popupView" class="ui-content" da ...

  4. iOS:模态弹出窗控制器UIPopoverPresentationController

    模态弹出窗控制器:UIPopoverPresentationController 实质:就是将内容控制器包装成PopoverPresentationController的形式,然后再模态出来,必须指定 ...

  5. iOS:弹出窗控制器:UIPopoverController

    弹出窗控制器:UIPopoverController 截图:   实质:就是将内容控制器包装成popoverController的形式,然后在模态出来,必须给定指向目标(target.frame). ...

  6. easyui弹出窗关闭前调用确认窗口,先关闭页面后调用弹出窗口

    弹出窗关闭的时候提示是否关闭,同时进行一些对应的方法调用, 然而在进行页面关闭调用的时候,往往页面关闭了,才弹出确认对话框, $.messager.confirm和panel的onBeforeClos ...

  7. Android应用之——百度地图最新SDK3.0应用,实现最经常使用的标注覆盖物以及弹出窗覆盖物

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/yanglfree/article/details/33333413 一.概述 最新版的百度地图SDK ...

  8. data-参数说明(模态弹出窗的使用)

    除了通过data-toggle和data-target来控制模态弹出窗之外,Bootstrap框架针对模态弹出框还提供了其他自定义data-属性,来控制模态弹出窗.比如说:是否有灰色背景modal-b ...

  9. jquery ui dialog弹出窗 清空缓存Cache或强制刷新

    我用jquery ui 弹出一个购物车的对话,通过AJAX加载的数据.发现购物车被缓存,一直看到是旧数据.为了刷新购物车更新,我必须去加一个刷新按钮,点击后更新购物车页面.有没有一种方法来自动刷新加载 ...

随机推荐

  1. 通过ip获取地理位置信息

    http://ipinfo.io/developers 直接使用get请求  url: http://ipinfo.io/json    即可获得json数据

  2. Learning WCF Chapter1 Hosting a Service in IIS

    How messages reach a service endpoint is a matter of protocols and hosting. IIS can host services ov ...

  3. (转载)mysql分屏显示结果

    (转载)http://blog.csdn.net/wylkeke/article/details/7280645 linux机器: 在mysql命令行输入pager more就可以分屏显示结果了,取消 ...

  4. 计算几何(凸包模板):HDU 1392 Surround the Trees

    There are a lot of trees in an area. A peasant wants to buy a rope to surround all these trees. So a ...

  5. C# Protect the Password inside a TextBox ZZ

    If the Text property is called, it will send an WM_GETTEXT message, so it will surely be an internal ...

  6. C# json

    C# 解析 json JSON(全称为JavaScript Object Notation) 是一种轻量级的数据交换格式.它是基于JavaScript语法标准的一个子集. JSON采用完全独立于语言的 ...

  7. Oracle statspack 安装及使用

    转载:http://blog.csdn.net/joinplay/article/details/23358133 oracle statspack 工具从oracle 8.1.6开始被引用,从ora ...

  8. usaco 奶牛集会 && 奶牛抗议

    奶牛集会 Description 约翰家的N头奶牛每年都会参加“哞哞大会” .哞哞大会是世界奶牛界的盛事.集会上 的活动很多,比如堆干草,跨栅栏,摸牛仔的屁股等等.当然,哞哞大叫肯定也包括在内. 奶牛 ...

  9. java 学习笔记4

    (1)      线程的强制运行 先看线程强制运行的实例 ,再解释程序中是如何让程序强制运行的 public class ThreadTest1 implementsRunnable { public ...

  10. 388. Longest Absolute File Path

    就是看哪个文件的绝对路径最长,不是看最深,是看最长,跟文件夹名,文件名都有关. \n表示一波,可能存在一个文件,可能只有文件夹,但是我们需要检测. 之后的\t表示层数. 思路是如果当前层数多余已经有的 ...