You can use an object to start a file download with javascript. This is being entered from the API files and is still in the working draft. This way you will have limited browser support. Since 2015 you have the broad support for the browser URL-addresses Blob and blocks constructor . Blob
<div ng-controller="appController" ng-app="app">
<a ng-href="{{ fileUrl }}" download="file.txt">download</a>
</div>
var app = angular.module('app', []);
app.config(['$compileProvider', function ($compileProvider) {
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|blob|ftp):/);
}]);
app.controller('appController', function ($scope, $window) {
var data = 'some data here...',
blob = new Blob([data], { type: 'text/plain' }),
url = $window.URL || $window.webkitURL;
$scope.fileUrl = url.createObjectURL(blob);
});
See the demo script here .
, Blob.js
FileSaver.js, data:URI.