(function() {
	window.app.factory("downloadSvc",
	[
		function() {

			var svc = {
				success: function(data, status, headers, config) {
					var file = new Blob([data], { type: headers("Content-Type") });
					var match = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(headers("Content-Disposition"));
					saveAs(file, match[1]);
				}
			};

			return svc;
		}
	]);
})();