Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.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
Angularjs 在数据库中使用$http获取表数据_Angularjs - Fatal编程技术网

Angularjs 在数据库中使用$http获取表数据

Angularjs 在数据库中使用$http获取表数据,angularjs,Angularjs,我是angular的新手,正在尝试从控制器加载表格数据。数据即将到来,但它没有显示在表格中。这里出了什么问题 <script> var app=angular .module("intranet_App", []) .controller('myCtrl', function ($scope, $http) { $http.post("/Admin/getRolesList

我是angular的新手,正在尝试从控制器加载表格数据。数据即将到来,但它没有显示在表格中。这里出了什么问题

<script>
    var app=angular
                .module("intranet_App", [])
                .controller('myCtrl', function ($scope, $http) {
                    $http.post("/Admin/getRolesList")
                    .then(function (response) {
                        console.log(response)
                        $scope.List= response.data;
                       console.log(List)
                    });
                })
</script>

这是我的响应格式:

您从like
数组中获取值。value
,它应该像
数组[0]。value
。因此,请使用
x.Id
而不是
List.Id

             <tbody>
                <tr ng-repeat="x in List">
                    <td>{{x.Id}}</td>
                    <td>{{x.name}}</td>
                </tr>
            </tbody>

{{x.Id}
{{x.name}

您已经从like
数组中获取了值。value
,它应该像
数组[0]。value
。因此,请使用
x.Id
而不是
List.Id

             <tbody>
                <tr ng-repeat="x in List">
                    <td>{{x.Id}}</td>
                    <td>{{x.name}}</td>
                </tr>
            </tbody>

{{x.Id}
{{x.name}
//使用跟踪方式进行性能优化。。
{{x.Id}
{{x.name}
//使用跟踪方式进行性能优化。。
{{x.Id}
{{x.name}

谢谢,伙计。工作:-)一个疑问,这里的
x是什么?我们可以用任何东西代替x,对吗?如果我想要1,2,3。。。在id的位置表示..如何在这里使用for循环?这里,
x
是表达式的对象名。更多细节:谢谢,伙计。工作:-)一个疑问,这里的
x
是什么?我们可以用任何东西代替x,对吗?如果我想要1,2,3。。。在id的位置表示..如何在这里使用for循环?这里,
x
是表达式的对象名。更多详细信息:请参阅此了解更多信息请参阅此了解更多信息
  //use track by for performance optimization..
         <tbody>
            <tr ng-repeat="x in List track by $index">
                <td>{{x.Id}}</td>
                <td>{{x.name}}</td>
            </tr>
        </tbody>