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
The problem is that I'm having problems to integrate the directive with my ionic app.
I've done the indicated steps:
bower install angular-pdf-viewer
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>
Include the lib as a dependency in your angular app:
var app = angular.module('App', ['pdf']);
Then I put this in the template
<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>
But I get this error
[$parse:syntax] Syntax Error: Token 'pdf' is an unexpected token at column 64 of the expression
What am I doing wrong?
Thanks in advance!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With