我有此页面,我正在尝试创建一个演示页面以下载pdf,如本资源所示。 https://github.com/MrRio/jsPDF
我已经创建了此页面,但是当我运行代码时,出现未捕获的进样器模块错误
这是代码段
<html ng-app="app">
<head>
<title>welcome to pdf</title>
</head>
<body ng-controller="MyController">
<p ng-click="HTMLclick()">click here</p>
<p id="pdfContent">
print here
</p>
</body>
</html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<script src="https://unpkg.com/jspdf@latest/dist/jspdf.min.js"></script>
<script>
var app = angular.module('app' ) ;
app.controller('MyController' , function($scope) {
$scope.HTMLclick = function () {
var pdf = new jsPDF();
pdf.addHTML(($("#pdfContent")[0]), { pagesplit: true }, function () {
pdf.save('myfilename' + '.pdf');
});
};
});
</script>
请问我在做什么错
答案 0 :(得分:2)
您在模块声明中缺少方括号[];
var app = angular.module('app', []);