如何在一个表中以角度js显示3集合数据

How to display the 3collections data in one table in angular js

本文关键字:js 显示 数据 集合 一个      更新时间:2023-09-26

我有 3 个集合和一个对象#

scope.quessionary={};
$scope.jobquestions=[{"id": 2,
                      "category": "raju",
                       "question": "haii?",}];
$scope.companyquestionsquestions=[{"id": 2,
                      "category": "ramu",
                       "question": "hello?",}];
$scope.departmentquestions=[{"id": 2,
                      "category": "somu",
                       "question": "hello?",}];

现在我必须显示一个表格中所有集合中的类别和问题字段值,如何显示?

你可以做这样的事情:

$scope.quessionary = [];
$scope.quessionary = $scope.quessionary.concat($scope.jobquestions).concat($scope.companyquestionsquestions).concat($scope.departmentquestions);

在 html 中:

<table>
    ....
    <tr ng-repeat="question in quessionary">
        <td>{{question.category}}</td>
        <td>{{question.question}}</td>
    </tr>
<table>