一、
1.下载
https://angularjs.org/
2.网络引用
https://code.angularjs.org/
3.模块内引用 angularjs
<body ng-app> </body>
二、表达式
1.一般表达式
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>Index</title> <script src="https://code.angularjs.org/1.6.2/angular.min.js"></script> </head> <body> <div ng-app > {{ 5 + 5 }} </div> </body> </html>
2.复合表达式
<body ng-app ng-init="obj={id:'1521',name:'oracle'}"> {{'id是:'+obj.id}}<br> {{'name是:'+obj.name}}<br> </body>
<body ng-app ng-init="obj=[{port:'1521',name:'oracle'},{id:'80',name:'http'}]"> {{'1521端口号代表:'+obj[0].name}}<br> {{'http端口号为:'+obj[1].id}}<br> </body>
3.双向绑定
<body> <div ng-app> <p>名字 : <input type="text" ng-model="name"></p> <h1>Hello {{name}}</h1> </div> </body>
三、模块与控制器