I am trying to cancel http requests in my angularjs project but I dont know how to do it. I am not that good with AngularJS so I am having trouble where and what I should do. Tried implementing something like this but failed.
What I want is to cancel http requests on requests in one service only. This is example of one request I have there:
    app.factory('reportService', function ($http, $state, toastService, $q) {
        var factory = {};
        factory.clicks = function (filter) {
            return $http({
                url: config.baseAddress + 'Report/Clicks',
                method: 'POST',
                data: filter
            }).then(function (response) {
                return response.data;
            },
            function (response) {
                toastService.error(response, 'reportService.clicks');
                return $q.reject(response);
            });
        };
});
Should I do something here, or maybe in app.js?
