Cancelling an angular service promise
<p>I have a controller that performs a http request.<br>
This request can take anywhere between 2 seconds to 4 minutes to return some data .<br>
I have added a button, that users should click to cancel the request if searches take too long to complete.</p>

<p><strong>Controller:</strong></p>

<pre><code>$scope.search = function() {
    myFactory.getResults()
        .then(function(data) {
        // some logic
        }, function(error) {
        // some logic
    });
}
</code></pre>

<p><strong>Service:</strong></p>

<pre><code>var myFactory = function($http, $q) {
    return {
        getResults: function(data) {
            var deffered = $q.dafer();
            var content = $http.get('someURL', {
                data: {},
                responseType: json
            )}

            deffered.resolve(content);
            returned deffered.promise;
        }
    }
}
</code></pre>

<p><strong>Button click:</strong></p>

<pre><code>$scope.cancelGetResults = function() {

    // some code to cancel myFactory.getResults() promise

}
</code></pre>

<p>How can I implement a button click to cancel the <code>myFactory.getResults()</code> promise?</p>