这有可能实现这样的代码: -
<tr ng-repeat="data in dataArray,value in valueArray">
{{data}} {{value}}
</tr>
Run Code Online (Sandbox Code Playgroud)
我有两个数组,我想在单行显示它们.
PS:我不是要求语法.我正在寻找实现这一目标的逻辑
谢谢
喜欢: - " http://jsfiddle.net/6ob5bkcx/1/ "
我试图在我的Angular应用程序中保持分页使用uib-pagination.我无法正确地做到这一点.
HTML
<table id="mytable" class="table table-striped">
<thead>
<tr class="table-head">
<th>Name</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="person in aCandidates">
<th>
<div>{{person}}</div>
</th>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
调节器
$scope.totalItems = $scope.aCandidates.length;
$scope.currentPage = 1;
$scope.itemsPerPage = 10;
Run Code Online (Sandbox Code Playgroud)
我能够看到分页栏但是没有执行任何操作,即使在将总项目设为10之后也会呈现整个表格数据.
uib-pagination究竟是如何工作的,以及数据(在这种情况下aCandidates)是如何与分页相关联的.
我有一个用户需要填写并提交的表格。单击“提交”按钮后,触发了一个应将数据推入数组的函数,但是我没有运气将其推入数组。需要将数据推入的阵列在另一个控制器中。
调试代码后,我发现此错误。
Cannot read property 'comments' of undefined
at n.$scope.submitComment (app.js:167)
Run Code Online (Sandbox Code Playgroud)
JavaScript / HTML
Cannot read property 'comments' of undefined
at n.$scope.submitComment (app.js:167)
Run Code Online (Sandbox Code Playgroud)
.controller('DishDetailController', ['$scope', function($scope) {
var dish = {
name: 'Uthapizza',
image: 'images/uthapizza.png',
category: 'mains',
label: 'Hot',
price: '4.99',
description: 'A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.',
comments: [{
rating: 5,
comment: "Imagine all the eatables, living in conFusion!",
author: …Run Code Online (Sandbox Code Playgroud)