html页面找不到angular
html page can not find angular
我在一个html页面中有下面的代码,正在运行它,尽管我一直收到一个错误,说"angular is not defined"我已经在头部中包含了angular,所以我不确定它为什么找不到它,我也可以直接点击angular的url。
<!DOCTYPE>
<html ng-app="test">
<head>
<title>
<script src="https://code.angularjs.org/1.2.25/angular.js"></script>
</title>
</head>
<body ng-controller="TestController">
<form name="CopyFile" ng-submit="copy(fileId)">
<input type="text" ng-model="fileId"/>
<input type="submit" value="Copy"/>
</form>
<div>{{ message }}</div>
<div>{{ error }}</div>
<script type="text/javascript">
(function () {
var app = angular.module("test", []);
var testController = function ($scope, $http) {
$scope.copy = function (fileId) {
$http.get("http://localhost/test/copy/prod.aspx/ToProd?fileId=" + fileId)
.then(onComplete, onError);
};
var onComplete = function (response) {
$scope.message = response;
};
var onError = function (reason) {
$scope.error = "File could not be copied " + reason;
};
};
app.controller("TestController", ["$scope", "$http"], testController);
} ());
</script>
</body>
</html>
这可能不是原因,但您不希望在标题中包含角度。它应该更像这样:
<!DOCTYPE>
<html ng-app="test">
<head>
<title>My Page</title>
<script src="https://code.angularjs.org/1.2.25/angular.js"></script>
</head>
.....
您在<title>
中给出了<script>
?
<title>
<script src="https://code.angularjs.org/1.2.25/angular.js"></script>
</title>
请把它移到外面。
相关文章:
- Angular 2:在本地.json文件上找不到文件
- grunt serve:dist时找不到Angular.js模块,但grunt serve工作正常
- 缺少 Angular JS 必需控制器错误:找不到指令所需的控制器“ngModel”
- 找不到Angular+Ionic Post请求获取404
- 可以'在Angular应用程序中找不到引导文件
- Angular html文件可以'找不到JS控制器[Node.JS/Angular]
- 我的Angular ui模态找不到模板
- Angular 中的$routeProvider在 undefined 中找不到
- 即 11 + angularjs 找不到 angular.element(“#idName”) 的范围
- Visual Studio 2013 找不到 angular 2 项目的 Typescript 版本
- Angular 调用自定义服务 - 找不到调用源
- Angular+Rails:Angular找不到控制器函数
- Visual Studio代码:找不到名称angular
- 如何在angular js中包含模块以删除找不到的错误模块
- 找不到变量Angular JS
- Angular在将脚本引用为ES6模块时找不到模块
- 找不到Angular.js Angular拖放自定义回调函数
- TypeScript的VS2015构建提供了“;TS2304:Build找不到有角度的“;错误,尽管存在angular.
- Angular内联模板404在drupal页面中找不到
- 在Angular Service中找不到方法