gpt4 book ai didi

javascript - Uncaught ReferenceError : angular is not defined.(新手发布)

转载 作者:行者123 更新时间:2023-11-30 20:19:37 29 4
gpt4 key购买 nike

大家好,我是 AngularJs 的新手。我收到错误:

" Uncaught ReferenceError: angular is not defined. "

我试图找出错误,但无法弄清楚。谢谢。我写的代码是:-

<html ng-app="firstApp">

<body ng-controller="firstController">
Enter 1st name:<input type="text" ng-model="firstName" />
<br/> Enter last Name:<input type="text" ng-model="lastName" />
<br>
<button ng-click="getFullName()">Get Full Name</button>
<hr/> Full Name:<label ng-bind="fullName"></label>
<script scr="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script>
var app = angular.module("firstApp", []);
app.controller("firstController", function($scope) {
$scope.firstName = "";
$scope.lastName = "";
$scope.fullName = "";
$scope.getFullName = function() {
$scope.fullName = $scope.firstName + "" + $scope.lastName;
};
});
</script>
</html>

最佳答案

你打错了,应该是src而不是scr

演示

<html ng-app="firstApp">
<body ng-controller="firstController">
Enter 1st name:<input type="text" ng-model="firstName"/>
<br/>
Enter last Name:<input type="text" ng-model="lastName"/>
<br>
<button ng-click="getFullName()">Get Full Name</button>
<hr/>
Full Name:<label ng-bind="fullName"></label>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script>
var app= angular.module("firstApp",[])
app.controller("firstController",function($scope)
{
$scope.firstName="";
$scope.lastName="";
$scope.fullName="";
$scope.getFullName=function()
{
$scope.fullName=$scope.firstName+""+$scope.lastName;
};
});
</script>
</body>

关于javascript - Uncaught ReferenceError : angular is not defined.(新手发布),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51591784/

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