Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.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
Json 无法将数据从服务绑定到服务器_Json_Symfony_Ionic Framework - Fatal编程技术网

Json 无法将数据从服务绑定到服务器

Json 无法将数据从服务绑定到服务器,json,symfony,ionic-framework,Json,Symfony,Ionic Framework,嗨,我想将来自symfony后端的数据绑定为json响应,如下所示 控制器 app.controller('DashboardCtrl',function($scope,$state,DashBoardServices) { $scope.allChilds = []; $scope.getAllChildDetails = function($http) { DashBoardServices.getAllChild("57cd019afbe0855c0e8b4568")

嗨,我想将来自symfony后端的数据绑定为json响应,如下所示

控制器

app.controller('DashboardCtrl',function($scope,$state,DashBoardServices) {

$scope.allChilds = [];

$scope.getAllChildDetails = function($http) {

    DashBoardServices.getAllChild("57cd019afbe0855c0e8b4568")
        .then(function (response) {

            $scope.allChilds = response.data;
            //grant access to the app
            if(response.data.MessageId == 1) {                    
                $state.go("child");//want to list all child data in this template
            }else{
                $state.go("dash");
            }

        });
}
});
服务

app.factory('DashBoardServices', function($http) {

 return {
         getAllChild: function (parentId) {
         return $http.post('http://127.1.1.0:8080/EduboldPortalApp/eduboldportal/web/app_dev.php/api/all/child', {
         parentId: parentId

         });
         }
});
Json响应

{
"MessageId": 1,
"data": [{
    "parentId": "57cd019afbe0855c0e8b4568",
    "id": {
        "$id": "57ccffd2fbe085880c8b4567"
    },
    "firstName": "PRATHAMVEER",
    "middleName": "SINGH",
    "lastName": "CHAHAL"
}, {
    "parentId": "57cd019afbe0855c0e8b4568",
    "id": {
        "$id": "57cd019afbe0855c0e8b4567"
    },
    "firstName": "GUNSHEEN",
    "middleName": "KAUR",
    "lastName": "CHAHAL"
}]
}
我有一个名为:allChild.html的模板,我想在其中列出所有子项,如下所示:

  <ion-content>
        <div class="list">
            <a ng-repeat="chd in allChilds"   class="item item-thumbnail-left">
           {{chd.firstName}}               

        </a>
</ion-content>

{{chd.firstName}
但它不是渲染数据,请帮助我刚刚开始使用离子


提前感谢

哪个控制器用于“allChild.html”?给那个控制器打电话。或者通过:$state.go(“child”{obj:yourObj})将数据传递到“allChild.html”;在controllercontroller中获取“$stateParams”是一样的:DashboardCtrlI正在尝试:$scope.allChilds=response.data//如果(response.data.MessageId==1){/$state.go(“child”);$state.go(“child”),{obj:$scope.allChilds};}其他{$state.go(“back”);}您能在这方面帮助我吗,我仍然没有在allChild中获取数据。html@SunilRawat您是否在此阶段将数据获取到$scope.allChilds
code DashBoardServices.getAllChild(“57cd019afbe0855c0e8b4568”)。然后(函数(响应){$scope.allChilds=response.data;//如果(response.data.MessageId==1)授予对应用程序的访问权限{$state.go(“child”);//是否列出此模板中的所有子数据}其他{$state.go(“dash”);})