0
我试图用特定路径下载位于本地机器上的文件。用AngularJs下载本地路径文件
我与下载下面的代码attrubit HTML5的方法和NG-HREF:
<file-download fileurl="{{ Pathfile }}" linktext="Click to download"></file-download>
myApp.directive('fileDownload', function(){
return {
restrict: 'E',
scope: {
fileurl: '@fileurl',
linktext: '@linktext'
},
template: '<a href="{{ fileurl }}" download>{{ linktext }}</a>',
link: function(scope, elem, attrs) {
}
}
});
我试着用下面的配置,但我得到了在网址中使用相同的不安全添加
myApp.config([
'$compileProvider',
function($compileProvider)
{
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|file|blob|ftp|mailto|chrome-extension):/);
}
]);
我总是在下载的网址中不安全。如何解决它?
你不能访问除服务器以外的任何文件 –
所以也许有另一种方式,如果我认为我的本地计算机是服务器? – selma