AngularJS - How to download a file with a button click?

I'm using a simple button, a click on it will run the next code (by using ng-click)

      scope.download_body = function(domain){

        var url = cfg.base+'accessLogBody?site='+domain;
          $http({withCredentials: true, cache:true, method: 'GET', url: url}).
              success(function(data, status, headers, config) {
                    console.log("$$$$$")
              }).
              error(function(data, status, headers, config) {
                 console.log("******")
              });            

      };

The thing is that I get to the success part of the code but there's no file download.

How may I use this code in order to get the browser to download the file?

Thanks for any kind of help