Skip to content

Commit

Permalink
fix: handle .getDocument error. fix #31
Browse files Browse the repository at this point in the history
  • Loading branch information
sayanee committed Feb 18, 2015
1 parent e41a584 commit ac90677
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions example/js/directives/angular-pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,20 @@
}
};

PDFJS.getDocument(url).then(function(_pdfDoc) {
pdfDoc = _pdfDoc;
scope.renderPage(scope.pageToDisplay);
PDFJS.getDocument(url).then(
function(_pdfDoc) {
pdfDoc = _pdfDoc;
scope.renderPage(scope.pageToDisplay);

scope.$apply(function() {
scope.pageCount = _pdfDoc.numPages;
});
});
scope.$apply(function() {
scope.pageCount = _pdfDoc.numPages;
});
}, function(error) {
if (error) {
console.log('ERROR in getting document: ' + error);
}
}
);

scope.$watch('pageNum', function(newVal) {
scope.pageToDisplay = parseInt(newVal);
Expand Down

0 comments on commit ac90677

Please sign in to comment.