未捕获错误:尝试加载pdf打印页时出现[$injector:modulerr]



我有一个页面,我正在尝试创建一个演示页面来下载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>

请问我做错了什么

模块声明中缺少方括号[];

var app = angular.module('app', []);

最新更新