我正在做角度js程序,但是这个功能是使用最新的角度cdn但是使用旧的v1.2.28及更低版本...但不能使用1.3或1.4 cdn,任何解决方案
function studentController($scope) {
$scope.student =
{
firstName: "john",
lastName: "wrick",
fullName: function () {`enter code here`
var studentObject;
studentObject = $scope.student;
return studentObject.firstName + " " + studentObject.lastName;
}
}
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Custom Controller Example</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src="js/ToutorialsPoint5.js"></script>
</head>
<body>
<div ng-app="" ng-controller="studentController">
First Name : <input type="text" ng-model="student.firstName" /><br /><br />
Last Name : <input type="text" ng-model="student.lastName" /><br /><br />
Your Full Name is : {{student.fullName()}}
</div>
</body>
</html>
答案 0 :(得分:0)
http://wildermuth.com/2014/11/11/Angular_1_3_and_Breaking_Change_for_Controllers
var app = angular.module(“myApp”,[]);
app.controller(“studentController”,function($ scope){ $ scope.student = { firstName:“约翰”, lastName:“Wrick”, fullName:function(){ var studentObject; studentObject = $ scope.student; return studentObject.firstName +“”+ studentObject.lastName; } }; });