Downloading an XML file using angularJs resource

I'm trying to use angularJs resource to download a file from a server but it dosen't work. my code is as following:

// service
angular.module("someModule")
.factory('generate', ['$resource', '$rootScope', function ($resource, $rootScope) {
return $resource('some url...');}]);


//Js controller file - I'm getting the 'generate' service in the head of the controller
 $scope.$on('generateFile', function(){
    generate.get();
});


//html
<a ng-click="$emit('generateFile')"></a>

When i'm typing the url it download the file - so the server side is fine. However, I couldn't find any example of using angular resource to download a file. Thanks for the help