Awesome
angular-ios-alertview
iOS7+ style alertview service for angular
Install
bower install angular-ios-alertview
Usage
- include
angular-ios-alertview.js
andangular-ios-alertview.css
in you html - include
angular-ios-alertview
in you angular dependencies - inject
iosAlertView
in you angular app
All options
(Note: some options are specific to different alertview type, e.g. remindTime
is only for iosAlertView.remind
)
-
title
, alertview title, default empty -
text
, alertview content, support html string. default empty -
input
, whether show input form, defaultfalse
-
inputType
, input field type, defaulttext
-
inputPlaceholder
, input field placeholder, default empty -
cancelText
, cancel button text, defaultCancel
-
okText
, ok button text, defaultOK
-
remindTime
, remind show duration, default250
ms -
buttons
, array of button object.an example of button object
{ text: 'OK', bold: true, onClick: function(data){ // data.index // data.button // data.inputValue } }
-
defaultOption
, the option key if you just pass in a string when you invokealert
,comfirm
,prompt
orremind
. defaulttext
, you can set it totitle
or something else.
APIs
-
iosAlertViewProvider.set
, set global option in you configBlock. -
iosAlertView
, base of other methods- params: string or object. when string, option[defaultOption] is set.
- return: promise
-
iosAlertView.alert
- params: string or object. when string, option[defaultOption] is set.
- return: promise
promise will be resoved when user click button
-
iosAlertView.confirm
- params: string or object. when string, option[defaultOption] is set.
- return: promise
promise will be resolved when user click OK button, or be rejected when user click Cancel button
-
iosAlertView.prompt
- params: string or object. when string, option[defaultOption] is set.
- return: promise
promise will be resolved with
inputValue
when user click OK button, or be rejected when user click Cancel button. -
iosAlertView.remind
- params: string or object. when string, option[defaultOption] is set.
- return: promise
promise will be resolved when
remindTime
later
License
MIT