title: how to push a task to background in angularjs
body: <p>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.</p>
  
  <pre><code>var data = {
                  "object":"value"
              };
  
              Data.post('url', data).then(function (result) {
                  if (result.status != 'error') {
                      $modalInstance.close();
                      alert('sent message')
  
                  } else {
                      console.log(result);
                  }
              })
  </code></pre>
  
  <p>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</p>