I am working on a project where i require to send messages to clients. I'd like to push this $http call to the background and only receive a small message at the top saying that messages were sent. Like in google mail box . Right now i have to wait for the messages to sent till then my modal freezes( I am using modal to enter the details in a form ). Thank you in advance for your help.
var data = {
"object":"value"
};
Data.post('url', data).then(function (result) {
if (result.status != 'error') {
$modalInstance.close();
alert('sent message')
} else {
console.log(result);
}
})
this is the process i need to send to the background. so what i want is that the modal needs to close as soon as i hit send report button which calls the above code. i want the above code to run in background and just get a small alert message at the top saying if the message was sent or not
If you want to close the modal at once, make the close()
call before you make the request.
var data = {
"object":"value"
};
$modalInstance.close();
Data.post('url', data).then(function (result) {
if (result.status != 'error') {
alert('sent message')
} else {
console.log(result);
}
})