我有這樣的角碼:
myApp.controller('en', [ '$scope', 'PDFViewerService', function($scope, pdf, $ionicLoading) {
console.log('en: new instance');
$scope.pdfURL = "http://www.tafseer.info/phocadownload/copy_of_the_book/khatima.pdf";//fe.toURL();
$scope.instance = pdf.Instance("viewer");
$scope.nextPage = function() {
$scope.instance.nextPage();
};
$scope.prevPage = function() {
$scope.instance.prevPage();
};
$scope.gotoPage = function(page) {
$scope.instance.gotoPage(page);
};
$scope.pageLoaded = function(curPage, totalPages) {
$scope.currentPage = curPage;
$scope.totalPages = totalPages;
};
$scope.loadProgress = function(loaded, total, state) {
console.log('loaded =', loaded, 'total =', total, 'state =', state);
};
}]);
而且在我的模板:
<button ng-click="prevPage()"><</button>
<button ng-click="nextPage()">></button>
<br>
<span>{{currentPage}}/{{totalPages}}</span>
<br>
<pdfviewer src="{{pdfURL}}" on-page-load='pageLoaded(page,total)' id="viewer"></pdfviewer>
我試圖讓插入到我的網站上的PDF文件與AngularJS,但我不斷收到相同的錯誤:
Error: $interpolate:interr Interpolation Error
爲什麼我得到這個錯誤,我該如何擺脫它?我要的只是插入PDF ...
什麼是PDFViewerService和pdfviewer指令? –
我使用這個https://github.com/akrennmair/ng-pdfviewer – AbuKotsh