首次点击获取信息失败;第二次点击成功

时间:2017-11-25 15:53:41

标签: javascript angularjs

我从api获取信息以提供下一个代码的列表:

function listData (){
       $http.get('http://cupones.clickonero.com.mx/api/InvoicePayments?')
        .then(function(data){
            $scope.list = data.data.Response;
             });
           }

并在html视图中:

<tr ng-repeat="info in list | filter: search">
                <th>{{info.Id}}</th>
                <th><a data-toggle="modal" href="#detailInvoice" ng-click="gralInfo(info)">{{info.Name}}</a></th>
                <th>{{info.value}}</th>
                <th>{{info.FiscalFolio}}</th>
</tr>

然后,要查看列表中每个值的完整数据,我使用下一段代码:

$scope.gralInfo = function(h){
        $scope.infoMan = h;
        //console.log($scope.infoMan);
    }

Html视图:

<div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel"><strong>DETAILS OF REQUEST NUMBER {{infoMan.Id}}</strong></h5>
                </div>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-md-6 .col-md-offset-3"><strong>Name:</strong> {{infoMan.Name}}</div>
                            <div class="col-md-6 .col-md-offset-3"><strong>Invoice:</strong> {{infoMan.InvoiceNumber}}</div>
                        </div>

正如您所看到的,使用gralInfo我可以在每次点击信息时查询。昨天,我使用ngRoute改变了我的代码的另一部分(但不是这部分)。而且,从那时起,每次我点击查看详细信息时,都不要在第一次点击时返回数据。直到第二个陈词滥调。

这听起来很尴尬,而且,在这一点上,我没有找到为什么这样做。任何人都知道为什么这样工作?

另外,我正在使用$ rootScope将一些值从我家传递到列表中。你认为这是因为这个吗?

0 个答案:

没有答案
相关问题