- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <!-- 引入AngularJS库 -->
- <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
- </head>
- <body>
- <table ng-app="myTable" ng-controller="empController">
- <tr>
- <th>雇员编号</th>
- <th>雇员名称</th>
- <th>薪水</th>
- </tr>
- <tr ng-repeat="i in emp">
- <td>{{i.eno}}</td><td>{{i.ename}}</td><td>{{i.sal}}</td>
- </tr>
- </table>
- </body>
- <script type="text/javascript">
- //获取app对象module
- var app = angular.module('myTable', []);
- //controller层会调用service层 控制层参数斥是提供服务的参数
- //$scope作用域 $location路径服务 $http发送ajax
- app.controller('empController', function($scope){
- $scope.emp=[
- {eno:1,ename:'zs',sal:1000},
- {eno:1,ename:'ls',sal:2000}
- ];
- });
- </script>
- </html>
AngularJs的forEach循环
最新推荐文章于 2021-09-08 13:47:01 发布