-1
이 angularJS 코드의 문제점은 무엇입니까? 그것은 작동하지 않습니다.코드가 작동하지 않습니다.
You are entering: {{student.fullName()}}
전체 코드는 다음과 같습니다 :
<html>
<head>
<script type = "javascript" src = "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js">
</script>
</head>
<body>
<div ng-app = "mainApp" ng-controller = "studentController">
Enter first name: <input type = "text" ng-model = "student.firstName"><br><br>
Enter last name: <input type = "text" ng-model = "student.lastName"><br>
<br>
You are entering: {{student.fullName()}}
</div>
<script>
var mainApp = angular.module("mainApp", []);
mainApp.controller('studentController', function($scope) {
$scope.student = {
firstName: "ABCD",
lastName: "EFGH",
fullName: function() {
var studentObject;
studentObject = $scope.student;
return studentObject.firstName + " " + studentObject.lastName;
}
}
});
</script>
</body>
</html>
: https://jsfiddle.net/U3pVM/26918/ – user2249160
@ user2249160 당신이'유형 = "자바 스크립트"와 각도가 포함되어 있지 않기 때문에 그렇습니다 작동 아래의 코드로 변경하십시오 '. ' – gianlucatursi
@gianlucatursi Strange로 바꾸십시오. angular.min.js가 javascript 파일 인 경우에도 type = 'javascript'를 포함 할 필요가 없습니다. – RKh