[英]How to show a pdf file in different window on button click in Angular 4
我是Angular 2的新手。在我的index.html中,我已在此指令內部執行了整個顯示。 在此內部,我有3個指令。
<app-header></app-header>
<app-content></app-content>
<app-footer></app-footer>
在其中有一些內容的內部,有一個按鈕,單擊該按鈕,我想在其他窗口中顯示一個已經存儲在我的項目中的pdf文件。 在該窗口中,只有pdf,沒有其他頁眉或頁腳。 怎么做。 這是我的html代碼-
<div class="col-md-8">
Designed to address massive data processing especially telecom data, storage and real-time analytics on the cloud. Reports and alarms on your handheld.
<p><a class="btn-u btn-u-sm" target="_blank" [routerLink]="['files/Skybase.pdf']">Download <i class="fa fa-angle-double-right margin-left-5"></i></a></p>
</div>
我不明白在app.module.ts中寫什么來路由和顯示pdf。
請幫我。
我認為您不應該在這里使用角度路由。 只需添加一個指向pdf文件位置的簡單鏈接( 完整 URL),使用_target=blank
,它將在新選項卡中打開。 一個例子:
<a href="http://www.thesitewizard.com/"; target="_blank">thesitewizard.com</a>
角度路由的目的是在不重新加載同一頁面的情況下工作,因此這有點超出角度范圍。 Angular用於編寫SPA(單頁應用程序),而在新選項卡中打開任何內容完全超出范圍。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.