案例:AngularJS案例     状态:可编辑再运行    进入横版
x
<script src="/js/angular.js1.4.6/angular1.2.5.min.js"></script>
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
5
<div ng-app="" ng-controller="personController">
6
7
名: <input type="text" ng-model="person.firstName"><br>
8
姓: <input type="text" ng-model="person.lastName"><br>
9
<br>
10
姓名: {{fullName()}}
11
12
</div>
13
14
<script>
15
function personController($scope) {
16
    $scope.person = {
17
        firstName: "John",
18
        lastName: "Doe",
19
    };
20
    $scope.fullName = function() {
21
        var x = $scope.person;  
22
        return x.firstName + " " + x.lastName;
23
    }
24
}

 运行结果 
 北美留学生论坛