You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SIPRP/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/services/Message.js

65 lines
1.5 KiB

//creates prompt messages
evoapp.factory('message', function($rootScope) {
//http://bootboxjs.com/#examples
//TODO: pass this to global utils!!! there's another one in DataService!!!
//pass specified values to specified function arguments
function callback(fn, args) {
var fnArgs = [].concat(args);
fnArgs.push.apply(fnArgs, arguments);
return fn.apply(this, fnArgs);
};
//globals.message.confirm({
// question: 'your message here',
// answer: function(result){
// if(result)
// {
// }
// }
//});
var confirm = function(){
var me = this;
var question = arguments[0].question,
answerFn = arguments[0].answer;
bootbox.confirm(question, function(result) {
callback(answerFn, [result]);
});
};
//globals.message.alert({
// message: 'your message here',
// callback: function(){
// }
//});
var alert = function(){
var me = this;
var message = arguments[0].message,
callbackFn = arguments[0].callback;
bootbox.alert(message, function() {
callback(callbackFn, [null]);
});
};
return {
confirm: confirm,
alert: alert
};
});