gpt4 book ai didi

Javascript 文件未加载

转载 作者:行者123 更新时间:2023-11-30 08:31:34 26 4
gpt4 key购买 nike

我是 Angular JS 的新手,正在尝试开发有关计算的小应用程序。我的代码如下”

<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<script src="scripts/angular.js"></script>
<script src="scripts/angular-route.js"></script>
</head>
<body>
<div ng-app="Calculator">
<div ng-controller="Operations">
<div>
Number 1 : <input type="number" ng-model="Number1" />
Number 2: <input type="number" ng-model="Number2" />
<p>
The addition of above two numbers is {{Number1+Number2}}
</p>
</div>

</div>
</div>
<script>
var module = angular.module('Calculator', []);
module.controller('Operations', function ($scope) {
$scope.Number1 = 1;
$scope.Number2 = 10;
});
</script>
</body>
</html>

我的项目中有可用的 Javascripts 文件,当我运行该应用程序时,浏览器控制台指示未加载 JS。不知道为什么!表达式 {{Number1+Number2}} 在浏览器中是相同的。它没有执行表达式

浏览器控制台有以下错误:

Failed to load resource:"Path to the Script file" the server responded with a status of 404 (Not Found)

Failed to load resource:"Path to the Script file" the server responded with a status of 404 (Not Found)

Uncaught ReferenceError: angular is not defined

最佳答案

<script src="scripts/angular.js"></script>
<script src="scripts/angular-route.js"></script>

您没有正确加载 angular.js 和 angular-route.js,请检查您的路径。

关于Javascript 文件未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37146287/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com