خرید بک لینک

Vote count: 0

Hi in my code below i am trying to convert xml Data to Json Object. using converted Json Object i am trying to create a table using angularjs. so here the problem is i am able to bind complete converted json object {{employeeList}} but failed to load individual atttribute of json object i.e.,{{metric.EmpId}}. finally from my observation i found when the converted json object is directly asigned to

$scope.Employees="Employee": [ {"EmpId": "4", "Name": "Chris", "Sex": "Male", "Phone": [ { "_Type": "Home", "__text": "564-555-0122" }, { "_Type": "Work", "__text": "442-555-0154" } ], "Address": { "Street": "124 Kutbay", "City": "Montara", "State": "CA", "Zip": "94037", "Country": "USA" } } ] }

the output is working as i expected but when i assign the direct result

i.e,$scope.Employees=response;it is not working what might be the issue

    
            <script>
                var app = angular.module('httpApp', []);
                app.controller('httpController', function ($scope, $http) {
                    $http.get("File1.xml",
                            {
                                transformResponse: function (cnv) {
                                    var x2js = new X2JS();
                                    var aftCnv = x2js.xml_str2json(cnv);
                                    retu aftCnv;
                                }
                            })
                    .success(function (response) {
                        console.log(response);
                        $scope.Employees = response;
                        console.log($scope.Employees);
                    });
                });
            </script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
             <div ng-app="httpApp" ng-controller="httpController">
                 <div ng-repeat="employeeList in Employees">
                     {{employeeList}}
                     {{employeeList.Employee.EmpId}}
                <table>
                    <tr ng-repeat="employee in employeeList">
                        {{employee}}
                        <td>{{employee.EmpId}}</td>
                        <td>{{employee.Name}}</td>
                    </tr>
                </table>
            </div>
            </div>

Converted Json Object

Output for {{Employeelist}}

asked 42 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 4 تير 1395 ساعت: 10:14

صفحه بندی