$ionicPopup

转自:http://www.ionicframework.com/docs/api/service/%24ionicPopup/

Usage

A few basic examples, see below for details about all of the options available.

angular.module('mySuperApp', ['ionic']) .controller('PopupCtrl',function($scope, $ionicPopup, $timeout) { // Triggered on a button click, or some other target $scope.showPopup = function() { $scope.data = {} // An elaborate, custom popup 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) { //don't allow the user to close unless he enters wifi password e.preventDefault(); } else { return $scope.data.wifi; } } } ] }); myPopup.then(function(res) { console.log('Tapped!', res); }); $timeout(function() { myPopup.close(); //close the popup after 3 seconds for some reason }, 3000); }; // A confirm dialog $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'); } }); }; // An alert dialog $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'); }); }; }); 

Methods

show(options)

Show a complex popup. This is the master show function for all popups.

A complex popup has a buttons array, with each button having a text and type field, in addition to an onTap function. The onTap function, called when the corresponding button on the popup is tapped, will by default close the popup and resolve the popup promise with its return value. If you wish to prevent the default and keep the popup open on button tap, call event.preventDefault() on the passed in tap event. Details below.

ParamTypeDetails
optionsobject

The options for the new popup, of the form:

{title: '', // String. The title of the popup.cssClass: '', // String, The custom CSS class namesubTitle: '', // String (optional). The sub-title of the popup.template: '', // String (optional). The html template to place in the popup body.templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.scope: null, // Scope (optional). A scope to link to the popup content.buttons: [{ // Array[Object] (optional). Buttons to place in the popup footer.text: 'Cancel',type: 'button-default',onTap: function(e) {// e.preventDefault() will stop the popup from closing when tapped.e.preventDefault();}}, {text: 'OK',type: 'button-positive',onTap: function(e) {// Returning a value will cause the promise to resolve with the given value.return scope.data.response;}}]
}
  • Returns: object A promise which is resolved when the popup is closed. Has an additional close function, which can be used to programmatically close the popup.

alert(options)

Show a simple alert popup with a message and one button that the user can tap to close the popup.

ParamTypeDetails
optionsobject

The options for showing the alert, of the form:

{title: '', // String. The title of the popup.cssClass: '', // String, The custom CSS class namesubTitle: '', // String (optional). The sub-title of the popup.template: '', // String (optional). The html template to place in the popup body.templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.okText: '', // String (default: 'OK'). The text of the OK button.okType: '', // String (default: 'button-positive'). The type of the OK button.
}
  • Returns: object A promise which is resolved when the popup is closed. Has one additional function close, which can be called with any value to programmatically close the popup with the given value.

confirm(options)

Show a simple confirm popup with a Cancel and OK button.

Resolves the promise with true if the user presses the OK button, and false if the user presses the Cancel button.

ParamTypeDetails
optionsobject

The options for showing the confirm popup, of the form:

{title: '', // String. The title of the popup.cssClass: '', // String, The custom CSS class namesubTitle: '', // String (optional). The sub-title of the popup.template: '', // String (optional). The html template to place in the popup body.templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.cancelText: '', // String (default: 'Cancel'). The text of the Cancel button.cancelType: '', // String (default: 'button-default'). The type of the Cancel button.okText: '', // String (default: 'OK'). The text of the OK button.okType: '', // String (default: 'button-positive'). The type of the OK button.
}
  • Returns: object A promise which is resolved when the popup is closed. Has one additional function close, which can be called with any value to programmatically close the popup with the given value.

prompt(options)

Show a simple prompt popup, which has an input, OK button, and Cancel button. Resolves the promise with the value of the input if the user presses OK, and with undefined if the user presses Cancel.

 $ionicPopup.prompt({title: 'Password Check', template: 'Enter your secret password', inputType: 'password', inputPlaceholder: 'Your password' }).then(function(res) { console.log('Your password is', res); }); 
ParamTypeDetails
optionsobject

The options for showing the prompt popup, of the form:

{title: '', // String. The title of the popup.cssClass: '', // String, The custom CSS class namesubTitle: '', // String (optional). The sub-title of the popup.template: '', // String (optional). The html template to place in the popup body.templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.inputType: // String (default: 'text'). The type of input to useinputPlaceholder: // String (default: ''). A placeholder to use for the input.cancelText: // String (default: 'Cancel'. The text of the Cancel button.cancelType: // String (default: 'button-default'). The type of the Cancel button.okText: // String (default: 'OK'). The text of the OK button.okType: // String (default: 'button-positive'). The type of the OK button.
}
  • Returns: object A promise which is resolved when the popup is closed. Has one additional function close, which can be called with any value to programmatically close the popup with the given value.

转载于:https://www.cnblogs.com/1992825-Amelia/p/4847076.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/258260.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Deep Learning(深度学习) 学习笔记(四)

神经概率语言模型&#xff0c;内容分为三块&#xff1a;问题&#xff0c;模型与准则&#xff0c;实验结果。[此节内容未完待续...] 1&#xff0c;语言模型问题 语言模型问题就是给定一个语言词典包括v个单词&#xff0c;对一个字串做出二元推断&#xff0c;推断其是否符合该语言…

JavaScript 运行机制

JavaScript 运行机制 阅读目录 一、为什么JavaScript是单线程&#xff1f;二、任务队列三、事件和回调函数四、Event Loop五、定时器六、Node.js的Event Loop七、关于setTimeout的测试一、为什么JavaScript是单线程&#xff1f; JavaScript语言是单线程&#xff0c;也就是说&am…

android自定义倒计时控件示例

这篇文章主要介绍了Android秒杀倒计时自定义TextView示例&#xff0c;大家参考使用吧 自定义TextView控件TimeTextView代码&#xff1a; 复制代码 代码如下:import android.content.Context;import android.content.res.TypedArray;import android.graphics.Paint;import andro…

从gitlab上拉代码_从gitlab上拉取代码并一键部署

一、gitlab安装GitLab是一个利用Ruby on Rails开发的开源应用程序&#xff0c;实现一个自托管的Git项目仓库&#xff0c;可通过Web界面进行访问公开的或者私人项目。GitLab拥有与Github类似的功能&#xff0c;能够浏览源代码&#xff0c;管理缺陷和注释。可以管理团队对仓库的访…

产品管理流程

转载于:https://www.cnblogs.com/candle806/p/4860841.html

如何根据灰度直方图计算标准差_如何根据电器功率计算电线的粗细?

一般来说&#xff0c;测算电线的粗细&#xff0c;需要根据功率计算电流&#xff0c;根据电流选择导线截面&#xff0c;根据导线的截面&#xff0c;导线或电缆的型号查厂家的该型号的导线电缆的直径。这里就涉及了&#xff1a;电线粗细与功率之间的关系计算&#xff1b;导线截面…

解惑烟草行业工控系统如何风险评估

上周五下午&#xff0c;威努特工控安全联合创始人 赵宇 先生&#xff0c;带来了一场关于“工控系统的风险评估”的技术讲座。此次近200注册报名的朋友&#xff0c;来自各大高校、国企、外企、测评中心、安全厂商、大型集成商以及大型IT科技企业、安全实验室等。 烟草企业调研参…

UVa 11806 Cheerleaders

题意&#xff1a;m行n列的矩形网格放k个相同的石子&#xff0c;要求第一行最后一行第一列最后一列都必须有石子&#xff0c;问有多少种放法 A为第一行没有石子的方案数&#xff0c;BCD依此类推&#xff0c;全集为S 如果没有任何要求的话&#xff0c;放法数应该是C(rc, k) 解法中…

为什么说一站式移动办公SaaS平台一定是未来!

摘要&#xff1a;移动办公SaaS之间的核心竞争不在于比拼技术&#xff0c;而在于谁更好地与企业管理和文化相互融合&#xff0c;给企业带来更加年轻、更加高效的工作方式&#xff0c;实现了企业组织的互联网化。 没有哪个企业愿意当诺基亚&#xff0c;“并没有做错什么&#xff…

server sql 将出生日期转为年龄_在sql server表中有一个出生日期字段我怎么才能在当前年份改变时自动更新年龄字段...

先说明下identity(1,1)&#xff1a;自动1foreign key 外键语法create database ztxuse ztxCreate Table QAUser--baidu用户资料(Id int Primary Key not null identity(1,1),--自动编号,也同时用于对用户的标示符QA_name varchar(20),--用户名Sex char(2),--或者使用bit类型,但…

自动裁剪图片

自动裁剪商品图片View Code执行裁剪指定目录商品图片动作///<summary> ///执行指定目录商品图片动作 ///</summary> public static void FindPictureDoCutIt(object o) {string filePatho.ToString();try{DirectioryInfo fatherFolder new DirectioryInfo(filePat…

32位oracle_oracle 性能调优

pool&#xff0c;sga&#xff0c;pga的配置 物理内存16G在调整SGA前&#xff0c;先看下服务器操作系统是32位还是64位的&#xff0c;如果是32位的&#xff0c;则SGA最大不能超过1.7G&#xff0c;如果是64位的&#xff0c;则不能超过4G。基本分配原则&#xff0c;db_block_buffe…

看网络电子围栏如何做好周界安防

围栏是为了保护一定范围内的任何物遭到侵害而设立的一个屏障&#xff0c;在一定程度上有保护的作用&#xff0c;但是也不能完全阻止。传统的围栏以加高或者添加危险触碰物来增加安全性&#xff0c;但是会影响美观&#xff0c;不能进行主动击退&#xff0c;也给围栏内人物带来不…

Objective-C语法之代码块(block)的使用

代码块本质上是和其它变量相似。不同的是&#xff0c;代码块存储的数据是一个函数体。使用代码块是&#xff0c;你能够像调用其它标准函数一样&#xff0c;传入參数数&#xff0c;并得到返回值。脱字符&#xff08;^&#xff09;是块的语法标记。依照我们熟悉的參数语法规约所定…

卓越管理的实践技巧(1)如何进行有效的指导 Guidelines for Effective Coaching

Guidelines for Effective Coaching 前文卓越管理的秘密&#xff08;Behind Closed Doors&#xff09;最后一部分提到了总结的13条卓越管理的实践技巧并列出了所有实践技巧名称的索引&#xff0c;这篇文章主要写卓越管理的实践技巧的第&#xff08;1&#xff09;条&#xff1a;…

count返回0_你是一直认为 count(1) 比 count(*) 效率高么?

MySQL count(1) 真的比 count(*) 快么? 反正同事们都是这么说的&#xff0c;我也姑且觉得对吧&#xff0c;那么没有自己研究一下究竟&#xff1f;如果我告诉你他们一样&#xff0c;你信么&#xff1f;有 Where 条件的 count&#xff0c;会根据扫码结果count 一下所有的行数&am…

dbeaver连接mysql失败_关于DBeaver连接MySQL数据库遇到的版本问题解决

在使用DBeaver连接MySQL数据库时&#xff0c;明明按照它提示进行jar包的下载&#xff0c;但是仍然报错&#xff0c;提示版本问题&#xff0c;那么这个时候我们要解决的就是MySQL版本对应驱动包的问题。笔者经过测试后有了一些心得&#xff0c;放上来希望对大家能够有所参考。首…

【WIN10】VisualStateManager使用說明

Demo下載&#xff1a;http://yunpan.cn/cFjgPtWRHKH9H 访问密码 c4b7 顧名思義&#xff0c;視圖狀態管理器。 在WPF中&#xff0c;它的功能似乎更強大。在UWP中&#xff0c;閹割了GotElementState方法&#xff0c;導致它只能在控件內部使用。 這個東東一般用來突出某些操作&am…

Hadoop伪分布配置与基于Eclipse开发环境搭建

国内私募机构九鼎控股打造APP&#xff0c;来就送 20元现金领取地址&#xff1a;http://jdb.jiudingcapital.com/phone.html内部邀请码&#xff1a;C8E245J &#xff08;不写邀请码&#xff0c;没有现金送&#xff09;国内私募机构九鼎控股打造&#xff0c;九鼎投资是在全国股份…

百度地图JavaScript API覆盖物旋转时出现偏移

在项目中&#xff0c;调用百度地图JavaScript API&#xff0c;做覆盖物的旋转再添加到地图上&#xff0c;结果出现偏移了。 调试过程中的效果图&#xff1a; 发现图片的旋转并不是按车子的中心来的&#xff0c;而是之外的一个点。最后发现犯了一个很细节的错&#xff1a; <s…