1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>ng_intro_controller</title> 6 <script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script> 7 </head> 8 <body> 9 <div ng-app="myapp" ng-controller="MyController"> 10 用户名:<input type="text" name="user" ng-model="user" /><br> 11 密 码:<input type="password" name="pwd" ng-model="pwd" /> 12 <div>您输入的用户名为:<span ng-bind="user"></span></div> 13 <div>您输入的密码是:<span ng-bind="pwd"></span></div> 14 </div> 15 </body> 16 <script> 17 angular.module("myapp",[]) 18 .controller("MyController",function($scope){ 19 $scope.user = "user"; 20 $scope.pwd = "pwd"; 21 }) 22 </script> 23 </html>