如何在html中为angularjs提供.pdf文件的链接?ng-src

How to give a link to .pdf file in html for angularjs? ng-src

本文关键字:文件 链接 ng-src pdf 提供 html 中为 angularjs      更新时间:2023-09-26

这是我的app.js文件中的一个Product details .

{
code:'18471IN-4-CP',
name:'Symbol Bath and Shower Trim',
price:22875.95,
description:'Symbol recessed bath and shower faucet trim with lever handle and diverter button.',
specification:'These are the new specs from json.',
canPurchase:true,
soldOut:false,
images:[
    {
        full:'BathTub.jpg',
        thumb:'Pipe.jpg'
    },
    {
        full:'Shower Trim1.jpg',
        thumb:'Pipe1.jpg'
    }
],
technicalDetail:'6311W-926.pdf',
cadDrawing: 'k_6311w_0.dwg'
},

下面的html代码根据app.js中的json var details从img文件夹加载图像

<img ng-src="img/{{product.images[0].thumb}}">

如何把链接,允许下载pdf (6311W-926.pdf这是在pdf文件夹)或任何其他文件扩展名?

像——ng-src = " pdf/{{product.technicalDetail}}"

试试这个:

<a ng-href="pdf/{{product.technicalDetail}}" target="_blank"> download pdf </a>