我正在尝试在IFrame中显示合并的pdf文件。如果我对ng-source进行硬编码,一切正常。
<iframe ng-src="~/Content/PdfFiles/MergedPdfs/Test.pdf" style="width:100%; height:600px;" type='application/pdf'></iframe>
如果我尝试...响应的值是“〜/ Content / PdfFiles / MergedPdfs / Test.pdf”
getMergedPdf().then(function (response)
{
$scope.mergedPdfFile = $sce.trustAsResourceUrl(response);
});
<iframe ng-src="{{trustSrc(mergedPdfFile)}}" style="width:100%; height:600px;" type='application/pdf'></iframe>
ng-srs的值为空。
如果我尝试......我收到404错误
getMergedPdf().then(function (response) {
$scope.mergedPdfFile = response;
});
这是http请求
function getMergedPdf()
{
return $http.post(baseUrl + 'Admin/getMergedPdf').then(function (response) {
return response.data;
})
}