Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在angularjs中创建表达式数组_Javascript_Angularjs - Fatal编程技术网

Javascript 如何在angularjs中创建表达式数组

Javascript 如何在angularjs中创建表达式数组,javascript,angularjs,Javascript,Angularjs,这是我的js代码 $scope.booking= function(docid,addid){ console.log(addid); $http({ method: 'POST', url: "http://localhost:81/DoctorStayServiceAngular/model/getDoctorBookingDetail.php",

这是我的js代码

 $scope.booking= function(docid,addid){
        console.log(addid);
        $http({
                method: 'POST',
                url: "http://localhost:81/DoctorStayServiceAngular/model/getDoctorBookingDetail.php",
                params:{"doctorid":docid,"addressid":addid,"day":weekday[d.getDay()]}
                //params:{"doctorid":docid}
            }).then(function mySucces(response) {
                //$scope.count= response.data;
                i++;
                $scope.count= i;
                //console.clear();
        });

    };
这是HTML

<div id="DocAppoinment" class="col-sm-3" ng-init="booking(x.profileid,x.addressid)">
     <span  ng-bind="count"></span>
</div>

这是我的输出

js函数将给我10个列表,我想在右边显示1到10,正如你们在输出中看到的那个样,由于明显的原因,它被覆盖了

那个么,在右边打印1到10应该怎么做呢?是否有表达式数组或其他形式?有什么建议吗


PS:我不熟悉这个框架。我认为您必须使用ng repeat指令

重复使用

$index、$first、$middle、$last

$index是一种显示循环的哪个迭代的方法。 例如

<div ng-repeat="x in response">
<div id="DocAppoinment" class="col-sm-3" ng-init="booking(x.profileid,x.addressid)">
    <span  ng-bind="count">{{$index + 1}}</span>
</div>
</div>

{{$index+1}}

我不认为这是一种固溶体,但一种方法是利用
ng repeat
中的
track by

例如:
ng repeat=“x in exxes track by$index”
并使用
{{{$index+1}
在html中显示数字

所以看起来像

<div ng-repeat="x in exs track by $index">
   <div id="DocAppoinment" class="col-sm-3" ng-init="booking(x.profileid,x.addressid)">
        <span  ng-bind="count">{{$index + 1}}</span>
   </div>
</div>

{{$index+1}}

所有这些都在
ng repeat
指令中吗?其中
x
是每个值吗?除了对框架来说是新的之外,您似乎对AJAX@AaronRussell是的,你是对的。@GeorgeJempty不,我知道AJAX的异步本质。你总是可以执行
ng repeat=“x in exxes track by$index”
并使用
{{$index+1}}
显示数字。