在离子应用程序中显示 pdf [英] Display pdf inside an ionic app
问题描述
我正在开发一个带有离子框架的应用程序,我需要显示一个 pdf.
Im developing an app with ionic framework and I need to display a pdf.
我在互联网上阅读了很多,发现这个指令可以使用
I've read a lot on the internet and found this directive to use
https://github.com/winkerVSbecks/angular-pdf-viewer
问题是我在将指令与我的 ionic 应用程序集成时遇到了问题.
The problem is that I'm having problems to integrate the directive with my ionic app.
我已经完成了指示的步骤:
I've done the indicated steps:
凉亭安装angular-pdf-viewer
bower install angular-pdf-viewer
包括 lib、AngularJS 和 PDFJS 的路径:(这里我更改了路径)
Include the path to the lib, AngularJS and PDFJS: (here I changed the paths)
<script src="lib/pdfjs-dist/build/pdf.js"></script>
<script src="lib/angular/angular.js"></script>
<script src="lib/angular-pdf-viewer/dist/angular-pdf-viewer.min.js"></script>
在您的 Angular 应用程序中包含 lib 作为依赖项:
Include the lib as a dependency in your angular app:
var app = angular.module('App', ['pdf']);
然后我把它放在模板中
<pdf-viewer delegate-handle="my-pdf-container" url="www.publishers.org.uk/_resources/assets/attachment/full/0/2091.pdf" scale="1" show-toolbar="true" ></pdf-viewer>
但我收到此错误
[$parse:syntax] 语法错误:标记 'pdf' 是表达式第 64 列的意外标记
[$parse:syntax] Syntax Error: Token 'pdf' is an unexpected token at column 64 of the expression
我做错了什么?
提前致谢!
推荐答案
我相信 url 值旨在指向您的范围.因此,鉴于您有 $scope.pdf = "the url you want",您可以在标签中执行 url="pdf".
I believe the url value is meant to point to your scope. So given that you have $scope.pdf = "the url you want", you would do url="pdf" in the tag.
这篇关于在离子应用程序中显示 pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!