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

 运行结果 
 北美留学生论坛