下载用angularjs生成的表单的html源代码 [英] Download the source code in html of a form generated with angularjs
本文介绍了下载用angularjs生成的表单的html源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
angularjs是否可以下载由表单生成的一段代码?
Is it possible by angularjs download a piece of code generated by a form?
添加一个简单的代码: http://jsbin.com/nufixiwali/edit?html,js,output
我会生成一个.html以仅下载html标记之后生成的代码.
I would generate an .html to download only the code generated after the html tag.
谢谢
推荐答案
类似
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)
这篇关于下载用angularjs生成的表单的html源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文