-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あなたは 'タイプ=「javascriptを」との角度は含まれておりませんので、はい働く以下のコードに変更してください。 '。これで置き換えてください: '' – gianlucatursi
@gianlucatursi Strange。 angular.min.jsがjavascriptファイルであっても、type = 'javascript'を含める必要はありません。 – RKh