【发布时间】:2016-10-17 06:27:52
【问题描述】:
我正在尝试显示来自 mongodb 的结果表,但我只是想收集一些结构并同时学习,所以我现在在控制器中得到了一些虚拟数据
app.controller('modal-controller', function($scope) {
$scope.fakeResults = [
{
"id": "1",
"location": "3",
"value": "27.5"
}, {
"id": "2",
"location": "3",
"value": "27.0"
}, {
"id": "3",
"location": "3",
"value": "27.2"
}, {
"id": "4",
"location": "3",
"value": "27.9"
}, {
"id": "5",
"location": "3",
"value": "28.5"
}
];
});
我试图查看结果的模态部分的 html 如下
<div ng-controller="modal-controller" class="portfolio-modal modal fade" id="portfolioModal1" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-content">
<div class="close-modal" data-dismiss="modal">
<div class="lr">
<div class="rl">
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<div class="modal-body">
<h2>Temperature Table</h2>
<hr class="star-primary">
<p>TEST TEXT {{ fakeResults }}</p>
<tbody>
<tr ng-repeat="result in fakeResults">
<td>{{$index + 1}}</td>
<td>{{result.id}}</td>
<td>{{result.location}}</td>
<td>{{result.value}}</td>
</tr>
</tbody>
<img src="img/portfolio/cabin.png" class="img-responsive img-centered" alt="">
<p>This page will be used to display simple table of temperature results</p>
<ul class="list-inline item-details">
<li>Hardware:
<strong>Tinkerforge equipment linked</strong>
</li>
<li>Software:
<strong>Github Link</strong>
</li>
<li>Difficulty:
<strong>1</strong>
</li>
</ul>
<button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
查看整个数据样本后可以看到结果,但使用 ng-repeat 时看不到。不太确定为什么会这样,但我希望将其范围缩小到 ng-repeat 附近。
谢谢
【问题讨论】:
标签: html angularjs modal-dialog ng-repeat