【发布时间】:2016-04-08 17:27:52
【问题描述】:
我无法在 html 中显示表格。当我对表中的值进行硬编码时,它们会出现,但在使用 angularjs 时它们不会出现。所以我认为这个问题与angualrjs中的某些东西有关。这是我要显示的 html 代码:
<div class="container">
<h2>Hover Rows</h2>
<p>The .table-hover class enables a hover state on table rows:</p>
<table class="table table-hover">
<thead>
<tr>
<th>Friends</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="Friends in AllUsersFriends">
<td>{{Friends}}</td>
</tr>
</tbody>
</table>
</div>
这是我的 controller.js 代码:
socket.on("AllFriends",function (Friends){
$log.log('so the friends are');
$scope.AllUsersFriends=Friends;
console.log($scope.AllUsersFriends);
$scope.$apply();
});
我通过 flask-socketio 接收一个数组,然后将该数组设置为我创建的 $scope.AllUsersFriends 数组。我在控制台中看到了数据,但屏幕上没有出现任何行。如何让我的数据出现在屏幕上?谢谢。
【问题讨论】:
-
在您的 console.log 中您是否传递了任何 HTML?也许有错误的标记导致行或
过早结束,这可能导致表格不出现,或者可能是某个类将表格设置为 display:none。只是一个想法
标签: javascript html angularjs twitter-bootstrap bootstrap-table