$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.pswp.cn/news/258260.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/258260.shtml
英文地址,請注明出處:http://en.pswp.cn/news/258260.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

目標規劃運籌學例題doc_運籌學之目標規劃(胡運權版).doc

運籌學之目標規劃(胡運權版).doc第七章 目標規劃1 目標規劃的提出線性規劃問題是討論一個給定的線性目標函數在一組線性約束條件下的最大值或最小值問題。對于一個實際問題&#xff0c;管理科學者根據管理層決策目標的要求&#xff0c;首先確定一個目標函數以衡量不同決策的優劣…

Deep Learning(深度學習) 學習筆記(四)

神經概率語言模型&#xff0c;內容分為三塊&#xff1a;問題&#xff0c;模型與準則&#xff0c;實驗結果。[此節內容未完待續...] 1&#xff0c;語言模型問題 語言模型問題就是給定一個語言詞典包括v個單詞&#xff0c;對一個字串做出二元推斷&#xff0c;推斷其是否符合該語言…

Java Virtual Machine

后續完善轉載于:https://www.cnblogs.com/fight-tao/p/4849167.html

selenium 鼠標懸浮_處理Selenium3+python3定位鼠標懸停才顯示的元素

先給大家介紹下Selenium3python3--如何定位鼠標懸停才顯示的元素定位鼠標懸停才顯示的元素&#xff0c;要引入新模塊# coding:utf-8from selenium import webdriverfrom selenium.webdriver.common.action_chains import ActionChainsdriver webdriver.Firefox()driver.get(&q…

JavaScript 運行機制

JavaScript 運行機制 閱讀目錄 一、為什么JavaScript是單線程&#xff1f;二、任務隊列三、事件和回調函數四、Event Loop五、定時器六、Node.js的Event Loop七、關于setTimeout的測試一、為什么JavaScript是單線程&#xff1f; JavaScript語言是單線程&#xff0c;也就是說&am…

mysql 時間 本周 本月_mysql查詢當天、本周、上周、本月、上月信息

今天select * from 表名 where to_days(時間字段名) to_days(now());昨天SELECT * FROM 表名 WHERE TO_DAYS( NOW( ) ) – TO_DAYS( 時間字段名) < 17天SELECT * FROM 表名 where DATE_SUB(CURDATE(), INTERVAL 7 DAY) < date(時間字段名)近30天SELECT * FROM 表名 wher…

android自定義倒計時控件示例

這篇文章主要介紹了Android秒殺倒計時自定義TextView示例&#xff0c;大家參考使用吧 自定義TextView控件TimeTextView代碼&#xff1a; 復制代碼 代碼如下:import android.content.Context;import android.content.res.TypedArray;import android.graphics.Paint;import andro…

Spring Cloud構建微服務架構:服務消費(Ribbon)【Dalston版】

通過上一篇《Spring Cloud構建微服務架構&#xff1a;服務消費&#xff08;基礎&#xff09;》&#xff0c;我們已經學會如何通過LoadBalancerClient接口來獲取某個服務的具體實例&#xff0c;并根據實例信息來發起服務接口消費請求。但是這樣的做法需要我們手工的去編寫服務選…

檢測是否點擊到精靈

需要給每個精靈設置tag.可以用枚舉 bool GE::GamePass::ccTouchBegan( cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent ) { const int iButtonCount 2; const int iButtonTags[iButtonCount] { GamePass_btn_share, GamePass_btn_return }; for(int i 0; i < iButt…

從gitlab上拉代碼_從gitlab上拉取代碼并一鍵部署

一、gitlab安裝GitLab是一個利用Ruby on Rails開發的開源應用程序&#xff0c;實現一個自托管的Git項目倉庫&#xff0c;可通過Web界面進行訪問公開的或者私人項目。GitLab擁有與Github類似的功能&#xff0c;能夠瀏覽源代碼&#xff0c;管理缺陷和注釋。可以管理團隊對倉庫的訪…

LPWA技術:發展物聯網的最佳選擇

物聯網時代的物物相連將會使百億以上物體連入網絡&#xff0c;這對傳統上的兩種通信技術&#xff0c;即近距離無線接入和移動蜂窩網提出了更高的要求。事實上&#xff0c;目前&#xff0c;用于物聯網發展的通信技術正在全球范圍內開發&#xff0c;低功耗廣域網通信技術(Low Pow…

上傳文件大小限制,webconfig和IIS配置大文件上傳

IIS6下上傳大文件沒有問題&#xff0c;但是遷移到IIS7下面&#xff0c;上傳大文件時&#xff0c;出現HTTP 404錯誤。 IIS配置上傳大小&#xff0c;webconfig <!-- 配置允許上傳大小 --><httpRuntime maxRequestLength"1997151" useFullyQualifiedRedirectU…

產品管理流程

轉載于:https://www.cnblogs.com/candle806/p/4860841.html

如何根據灰度直方圖計算標準差_如何根據電器功率計算電線的粗細?

一般來說&#xff0c;測算電線的粗細&#xff0c;需要根據功率計算電流&#xff0c;根據電流選擇導線截面&#xff0c;根據導線的截面&#xff0c;導線或電纜的型號查廠家的該型號的導線電纜的直徑。這里就涉及了&#xff1a;電線粗細與功率之間的關系計算&#xff1b;導線截面…

解惑煙草行業工控系統如何風險評估

上周五下午&#xff0c;威努特工控安全聯合創始人 趙宇 先生&#xff0c;帶來了一場關于“工控系統的風險評估”的技術講座。此次近200注冊報名的朋友&#xff0c;來自各大高校、國企、外企、測評中心、安全廠商、大型集成商以及大型IT科技企業、安全實驗室等。 煙草企業調研參…

ORACLE union order by

select * from ( select a.id,a.oacode,a.custid,a.custname,a.xsz,a.salename,a.communicationtheme,a.communicationproperty,a.communicationtime,a.productmanager,a.creator,a.createdate from technology_flow a where a.oastate正常結束 union select b.id,b.oacode,b…

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類型,但…

MySQL關聯left join 條件on與where不同

以下的文章主要講述的是MySQL關聯left join 條件on與where 條件的不同之處&#xff0c;我們現在有兩個表&#xff0c;即商品表(products)與sales_detail(銷售記錄表)。我們主要是通過這兩個表來對MySQL關聯left join 條件on與where 條件的不同之處進行講述。 products: pid pna…