1.引入JS

<script type="text/javascript" src="../plugins/angularjs/angular.min.js"></script>

 

2.指定模块和控制器

 

<body class="hold-transition skin-red sidebar-mini" ng-app="pinyougou" ng-controller="brandController" ng-init = findAll()>

 

3.编写js代码

<script type="text/javascript">
        var app= angular.module('pinyougou',[]);//定义模块
            app.controller('brandController',function($scope,$http){
            //读取列表
            $scope.findAll = function(){
                $http.get('../brand/findAll.do').success(
                        function(response){
                            $scope.list = response;
                        }
                );
            }    
        });
    </script>

 

4.循环数据表格

<tbody>
    <tr ng-repeat="entity in list">
         <td><input  type="checkbox" ></td>                                          
         <td>{{entity.id}}</td>
         <td>{{entity.name}}</td>                                         
         <td>{{entity.firstChar}}</td>                                         
          <td class="text-center">                                           
          <button type="button" class="btn bg-olive btn-xs" data-toggle="modal" data-target="#editModal"  >修改</button>                                           
          </td>
     </tr>                                     
</tbody>

 

5.结果显示

 

posted on 2019-05-01 18:43  深海收破烂  阅读(1075)  评论(7编辑  收藏  举报