AngularJS入门3

实现效果:

代码:

 1 <DOCTYPE html>
 2 <html ng-app="MyApp">
 3 <head>
 4 <meta chartset="utf-8">
 5 <title>数据正向绑定 </title>
 6 <script src="jquery-1.10.2.min.js"></script>
 7 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
 8 </head>
 9 <body>
10 <div ng-controller="TestCtrl">
11    <input type="text" value="" id="a">
12 </div>
13 <script type="text/javascript">
14  var TestCtrl=function(){
15       console.log('ok');
16  }
17 angular.module('MyApp',[],function(){console.log('here');});
18 </script>
19 </body>
20 </html>

来源:http://www.zouyesheng.com/angular.html#toc4 感谢作者分享

原文地址:https://www.cnblogs.com/luckyflower/p/4024679.html