小编Lea*_*ead的帖子

Angularjs - 多个$ http REST调用(第二个调用依赖于第一个输出)

我是AngularJs世界的新手 - 我试图从两个REST WS调用中获取数据.

第一个返回一组数据(工作正常) - 使用第一个数据的值,我需要进行另一个webservice调用并检索数据并在表中打印.

以下是我到目前为止所尝试的内容:HTML:

<table ng-table="tableParams" id="request_table" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
    <tr>
        <th>Number</th>
        <th>Price</th>
        <th>Short Description</th>
        <th>Requested for</th>
        <th>State</th>
    </tr>
</thead>
<tbody>
    <tr ng-repeat="request in req_list | orderBy:sortType:sortReverse | filter: searchItem">
        <p ng-repeat="item in fetchRequest(request.price)"></p>

        <td>{{request.number }}</td>
        <td>{{request.price}}</td>
        <td>{{request.short_description}}</td>
        <td>{{request.requested_for.display_value}}</td>
        <td>{{request.stage}}</td>
    </tr>

</tbody>
Run Code Online (Sandbox Code Playgroud)

脚本:

            angular.module('sc_request_list')
            .controller('MyRequestItems', [
                '$scope',
                '$http',
                function($scope, $http) {
                    $scope.sortType = 'number' //set the default sort type
                    $scope.sortReverse = false; // set the default sort order
                    $scope.searchItem // set the default …
Run Code Online (Sandbox Code Playgroud)

http angularjs

4
推荐指数
2
解决办法
2万
查看次数

标签 统计

angularjs ×1

http ×1