1 <div ng-app="myApp" ng-controller="myCtrl"> 2 名:<input type="text" ng-model="firstName"> 3 姓:<input type="text" ng-model="lastName"> 4 <br> 5 姓名:{{firstName + lastName}} 6 </div> 7 <script> 8 var app = angular.module(‘myApp‘,[]); 9 app.controller(‘myCtrl‘,function($scope){ 10 $scope.firstName = "John"; 11 $scope.lastName = "Doe"; 12 }); 13 </script>
原文:http://www.cnblogs.com/caicaidandan/p/6685644.html