Download The Source Code In Html Of A Form Generated With Angularjs
Is it possible by angularjs download a piece of code generated by a form? Add a simple code: http://jsbin.com/nufixiwali/edit?html,js,output I would generate an .html to download o
Solution 1:
something like
function downloadAsFile(filename, type, data) {
window.URL = window.URL || window.webkitURL;
var a = document.createElement("a");
var blob = new Blob([data], {type: type});
var url = window.URL.createObjectURL(blob);
document.body.appendChild(a);
a.style = "display: none";
a.href = url;
a.download = filename;
a.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
}
downloadAsFile('myfile.html', 'text/html', myData)
Post a Comment for "Download The Source Code In Html Of A Form Generated With Angularjs"