【发布时间】:2017-07-16 12:32:47
【问题描述】:
我几乎到处都在寻找这个,但如果我最终遗漏了什么,请原谅我。 这是我的html:
<!DOCTYPE html>
<html>
<head>
<title>PDFHandle</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.5/angular.js"></script>
<script type="text/javascript" src="{{ url_for('static', filename='custom.js') }}"></script>
</head>
<body>
{% raw %}
<div ng-app="uploadApp" ng-controller="UploadController as uc">
<div ng-repeat="choice in uc.choices">
<input value="{{choice.value}}" />
</div>
<button ng-click="uc.addChoice()">Add</button>
</div>
{% endraw %}
</body>
</html>
这是我的 AngularJS 脚本:
var Try = angular.module("uploadApp", [])
.controller("UploadController", function UploadController() {
this.choices = [{id: "choice1", value:"Hello"}];
this.addChoice = function() {
return this.choices.push({id:"choice"+(this.choices.length+1), value:"Hello Again"});
};
})
我面临的问题是这样的(显示在 Chrome 的开发者工具中):
Uncaught Error: [$injector:modulerr] Failed to instantiate module uploadApp due to:
Error: [$injector:nomod] Module 'uploadApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
我可以通过正常地将它与 HTML 文件链接来运行它,只是当我尝试将它与烧瓶渲染的 HTML 一起使用时它不起作用。我也尝试过使用其他 Angular IDE,并且在它们中也可以正常工作。就像我说的,只是不适用于烧瓶。 任何帮助将不胜感激。谢谢!
【问题讨论】: