我需要在我的网络应用程序中使用pdf查看器,该应用程序位于anugularjs中。我找到了Angular PDF查看器,它对我来说没问题。但我不知道使用什么代码插入。
目前我还是:
in html:
<div ui-content-for="title">
<span class="small"></span>
</div>
<div class="scrollable">
<div class="scrollable-content">
<div class="list-group">
<site-frame style="display:block; height: 100%;">
<pdf-viewer
delegate-handle="my-pdf-container"
url="pdfUrl"
scale="1"
show-toolbar="true"
headers="{ 'x-you-know-whats-awesome': 'EVERYTHING' }">
</pdf-viewer>
<button class="btn btn-default" ng-click="loadNewFile('position/file.pdf')">Load</button>
</site-frame>
</div>
</div>
</div>
在控制器中:
'use strict';
var pdfControllerModule = angular.module('pdfControllerModule', ['ServiceOModule']);
pdfControllerModule.controller('pdfController',
['$scope','pdfDelegate', '$routeParams', 'Service_o', function($scope, pdfDelegate ,$routeParams, Service_o) {
$scope.pdfUrl = 'position/file.pdf';
$scope.loadNewFile = function(url) {
pdfDelegate
.$getByHandle('my-pdf-container')
.load(url);
};
}]);
什么是不正确的,我插入了什么代码? 或者如果你知道要在这两个文件中插入正确的代码,你会写信给我吗?谢谢帮帮我
答案 0 :(得分:0)
我没有看到代码有任何问题。只需确保您在主应用程序模块中引用了pdf.js. angular.module( '应用',[ 'PDF']) 此外,html需要引用pdf.combined和angular-pdf-viewer js文件。