我的ng-repeat没有用! AngularJs

时间:2017-04-16 18:33:01

标签: javascript html angularjs

## HTML文件:##

<html ng-app = "TM">
<h1> Requested Businesses </h1>
<form class="form">
<body ng-controller = "appController">
  <table class="col-xs-12">
    <tr>
      <th>Email</th>
      <th>BusinessName</th>
      <th></th>
    </tr>

 <h1 ng-repeat= "item in protocolList">
      <tr>
        <td>{{item.requesterMail}}</td>
        <td>{{item.business_name}}</td>
  
    

我的html视图中没有显示任何内容:(

  

##角度控制器:##

angular.module('TM', ['AppRoutes']).controller('appController', function($scope, $http,$location){

   $http({
    method: 'GET',
     url: '../businessreq',
     }).then(function(data) { 
    $scope.protocolList= data.data;
    console.log($scope.protocolList);       

});  

});
  
    

控制台正确打印protocolList

  

1 个答案:

答案 0 :(得分:4)

td元素之间不能有h1。将ng-repeat放入tr,删除你的h1,它应该有效。