TNotify [DEPRECATED!] Please use angular-ios-alertview
ios7+ style alert confirm and prompt service for angular
- include
tnotify[.min].js
andtnotify[.min].css
in your html. - include
TNotify
as a angular dependence - inject
TNotify
in your controllers, services or something else. - use
TNotify.alert
,TNotify.confirm
orTNotify.prompt
.
- title => default empty, this is shown in modal title
- text => required when you invoke
alert
orconfirm
orprompt
, tell user what do you want. Its best to set the text option when you invoke specific method. - cancelText => cancel button text, default
取消
- okText => ok button text, default
确定
- inputType => the prompt input type, default
text
- inputPlaceHolder => the prompt input placeholder, default empty
You can use TNotifyProvider
to set default option via
module.config(['TNotifyProvider', function(TNotifyProvider){
TNotifyProvider.set('title', 'default Title');
TNotifyProvider.set({
cancelText: 'cancel',
okText: 'good'
});
}]);
- alert
- params: String or Object. when string, the
option.text
is set. - return: promise.
- example
TNotify.alert('alert').then(function(){ // Your code here. });
- params: String or Object. when string, the
- confirm
- params: String or Object. when string, the
option.text
is set. - return: promise. then callback function will get the user's confirm:
true
orfalse
- example
TNotify.confirm('Do you want to cancel?').then(function(result){ if(result === true){ // yes }else if(result === false){ // no } });
- params: String or Object. when string, the
- prompt
- params: String or Object. when string, the
option.text
is set. - return: promise. the callback function will get the user's input(empty string or what the user input) when use click ok button, or get
null
when user click cancel button. - example
TNotify.prompt('input your telphone').then(function(result){ console.log(result); // the result will be `null` when user click cancel button // the result will be what the user input or empty string // when user click ok button });
- params: String or Object. when string, the
- The modal style is borrowed from Framework7
MIT