Angular.js를 사용하여 JSON에서 중첩 된 객체 배열 구문 분석

MAK

Angular.js를 처음 사용합니다. 여기서 저는 제품의 이미지, 이름 및 비용을 표시해야하는 장바구니를 개발하고 있습니다. 여러 테넌트가 있고 각 테넌트에는 listOfMerchandise가 포함 된 listOfBinaries 배열이 있습니다. 내 문제는 테넌트의 이름, listOfBinary의 이미지 및 listOfMerchandise의 비용을 표시해야한다는 것입니다. 아래와 같이 JSON을 구문 분석했지만 실행하는 동안 빈 페이지가 나타납니다. 누구든지 나를 도울 수 있습니까? REST URL에 AJAX 호출을 한 후 얻은 JSON은 다음과 같습니다.

{
"_links": {
    "search": {
        "href": "http://localhost:8080/sportsrest/tenants/search"
    }
},
"_embedded": {
    "tenants": [
        {
            "name": "tenant1",
            "domainName": "gaming.com",
            "description": "sasasa",
            "listOfBinary": [
                {
                    "imageURL": "http://i.telegraph.co.uk/multimedia/archive/02602/premier-league_2602603b.jpg",
                    "username": "Sumanth",
                    "description": "imagSky Sports offer free live Premier League action on o Sky Sports offer free live Premier League action on opening weekend of season as battle witpening weekend of season as battle wite1",
                    "listOfMerchandise": [
                        {
                            "rate": 100,
                            "type": "item1",
                            "shortDescription": "test1"
                        }
                    ]
                },
                {
                    "imageURL": "http://images.clipartpanda.com/sports-equipment-clipart-black-and-white-soccer-ball-hi.png",
                    "username": "as",
                    "description": "Sky Sports offer free live Premier League action on opening weekend of season as battle wit Sky Sports offer free live Premier League action on opening weekend of season as battle wit",
                    "listOfMerchandise": [
                        {
                            "rate": 200,
                            "type": "item2",
                            "shortDescription": "test2"
                        }
                    ]
                }
            ],
            "merchandise": null,
            "_links": {
                "self": {
                    "href": "http://localhost:8080/sportsrest/tenants/2"
                },
                "listOfCustomerPackage": {
                    "href": "http://localhost:8080/sportsrest/tenants/2/listOfCustomerPackage"
                }
            }
        },
        {
            "name": "tenant2",
            "domainName": "cric.io",
            "listOfBinary": [
                {
                    "imageURL": "http://i.telegraph.co.uk/multimedia/archive/02602/premier-league_2602603b.jpg",
                    "username": "Sumanth",
                    "description": "Sky Sports offer free live Premier League action on opening weekend of season as battle wit Sky Sports offer free live Premier League action on opening weekend of season as battle wit",
                    "listOfMerchandise": [
                        {
                            "rate": 500,
                            "type": "item5",
                            "shortDescription": "test5"
                        }

                    ]
                },
                {
                    "imageURL": "www.test.com",
                    "username": "sumanth",
                    "description": "sample",
                    "listOfMerchandise": [
                        {
                            "rate": 2323,
                            "type": "type7",
                            "shortDescription": "test"
                        }
                    ]
                }
            ],
            "merchandise": null,
            "_links": {
                "self": {
                    "href": "http://localhost:8080/sportsrest/tenants/9"
                },
                "listOfCustomerPackage": {
                    "href": "http://localhost:8080/sportsrest/tenants/9/listOfCustomerPackage"
                }
            }
        },
        {
            "name": "tenant5",
            "domainName": "test.co",
            "description": "test 123 ",
            "listOfBinary": [],
            "binary": {
                "fileLocation": "www.test.com",
                "username": "sumanth",
                "description": "sample",
                "listOfMerchandise": [
                    {
                        "rate": 2323,
                        "type": "trt",
                        "shortDescription": "rtrtrt"
                    }
                ]
            }
        }
    ]
}

}

내 directives.js 파일 :이 Ajax 호출을 할 때 JSON 이상이됩니다.

 myAppDirectives.
  controller('items_display', function ($scope,$http) {
 $http({ method: 'GET', url: 'http://localhost:8080/sportsrest/tenants/' }).success(function (data) {
 $scope.carts=data; 
 }).
 error(function (data) {
     alert("error" + data);
     console.log(data);
 });
 });

내 HTML 페이지 :

<!DOCTYPE html>
 < html ng-app="myApp">
<head>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>

   </head>
   <body>
    <div ng-app="myApp" >
    <div  ng-controller="items_display">
    <div  ng-repeat="item in carts._embedded.tenants">
    <div type="text" class="item_name" value={{item.name}}  > 
    <div  ng-repeat="item in carts._embedded.tenants.listOfBinary">
     <img  class="shop_img" ng-src="{{item.fileLocation}}"  ng-style="{'width':'100px', 'height':'100px'}" /> 
     <div  ng-repeat="item in carts._embedded.tenants.listOfBinary.listOfMerchandise">
      <div type="text" class="item_cost" value={{item.rate}}  > 
    </div>  
      </br>
     </div>
    </div>
    </div>
</body>

누구나 Angular.js를 사용하여 html 페이지에 제품 세부 정보를 표시하는 데 도움을 줄 수 있습니까?

미리 감사드립니다

Maurica

당신의 마크 업이 모두 엉망이되었습니다. 제가 당신의 데이터와 마크 업으로 만든 플 런커를 확인하세요

http://plnkr.co/edit/jGCm6nO9S4hlNxLCyrSy?p=preview

<body>
  <div ng-app="myApp">
    <div ng-controller="items_display">
      <div ng-repeat="tenant in carts._embedded.tenants">
        <div type="text" class="item_name">{{tenant.name}}
          <div ng-repeat="binary in tenant.listOfBinary">
            <img class="shop_img" ng-src="{{binary.fileLocation}}" ng-style="{'width':'100px', 'height':'100px'}" />
            <div ng-repeat="(key, value) in binary.listOfMerchandise[0]">
              <div type="text" class="item_cost">{{key}}: {{value}}
              </div>
              <br>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Volley를 사용하여 중첩 된 JSON 개체 구문 분석

분류에서Dev

중첩 된 객체를 포함하는 JSON 구문 분석

분류에서Dev

URL에서 중첩 된 JSON을 구문 분석하고 Java를 사용하여 배열에서 값 추출

분류에서Dev

iOS에서 배열 데이터 내부의 중첩 된 Json 개체를 구문 분석하는 방법

분류에서Dev

Moya.Response 쿼리를 통해 반환 된 객체에서 중첩 된 JSON 배열을 구문 분석하는 방법

분류에서Dev

Spark에 중첩 된 Json 객체를 구문 분석하는 방법

분류에서Dev

Gson을 사용하여 키없이 중첩 된 JSON 객체 구문 분석

분류에서Dev

Postgres를 사용하여 문자열 화 된 JSON 객체 구문 분석

분류에서Dev

파이썬에서 객체를 사용하여 JSON 배열 구문 분석

분류에서Dev

Object Mapper를 사용하여 중첩 된 사전 배열 구문 분석

분류에서Dev

JQuery를 사용하여 중첩 된 JSON 구문 분석

분류에서Dev

jquery 및 Ajax를 사용하여 중첩 된 JSON 구문 분석

분류에서Dev

Angular : FormArray를 사용하여 개체 배열에 중첩 된 ngFor

분류에서Dev

Android에서 중첩 된 JSON 배열을 구문 분석하는 방법

분류에서Dev

각도를 사용하여 Json 객체에서 Json 배열을 구문 분석하는 방법

분류에서Dev

Gson을 사용하여 중첩 배열로 JSON 구문 분석

분류에서Dev

VBA 및 JSON을 사용하여 중첩 배열 구문 분석

분류에서Dev

중첩 된 Json 객체를 구문 분석하고 Android의 데이터베이스에 저장

분류에서Dev

UDF를 사용하여 PySpark Dataframe에서 중첩 된 XML 필드 구문 분석

분류에서Dev

자바에서 중첩 된 JSON 배열 구문 분석

분류에서Dev

JAXB를 사용하여 Java에서 중첩 된 XML 객체 목록을 어떻게 구문 분석 할 수 있습니까?

분류에서Dev

Javacript에서 JSON 객체를 구문 분석하여 배열 생성

분류에서Dev

Jackson 2.0을 사용하여 JSON 객체 배열 구문 분석

분류에서Dev

json.net-중첩 된 객체를 구문 분석 할 수 없음

분류에서Dev

당신은 어떻게 처리 JSON 객체를 사용하여 다음과 같은 중첩 된 JSON 파일을 구문 분석합니까?

분류에서Dev

Axios 및 Async / Await를 사용하여 중첩 된 JSON 구문 분석

분류에서Dev

중첩 된 "목록"과 함께 .NET deserialize ()를 사용하여 JSON 구문 분석

분류에서Dev

자바 스크립트를 사용하여 중첩 된 JSON 구문 분석

분류에서Dev

Android 용 RetroFit을 사용하여 중첩 된 JSON 구문 분석

Related 관련 기사

  1. 1

    Volley를 사용하여 중첩 된 JSON 개체 구문 분석

  2. 2

    중첩 된 객체를 포함하는 JSON 구문 분석

  3. 3

    URL에서 중첩 된 JSON을 구문 분석하고 Java를 사용하여 배열에서 값 추출

  4. 4

    iOS에서 배열 데이터 내부의 중첩 된 Json 개체를 구문 분석하는 방법

  5. 5

    Moya.Response 쿼리를 통해 반환 된 객체에서 중첩 된 JSON 배열을 구문 분석하는 방법

  6. 6

    Spark에 중첩 된 Json 객체를 구문 분석하는 방법

  7. 7

    Gson을 사용하여 키없이 중첩 된 JSON 객체 구문 분석

  8. 8

    Postgres를 사용하여 문자열 화 된 JSON 객체 구문 분석

  9. 9

    파이썬에서 객체를 사용하여 JSON 배열 구문 분석

  10. 10

    Object Mapper를 사용하여 중첩 된 사전 배열 구문 분석

  11. 11

    JQuery를 사용하여 중첩 된 JSON 구문 분석

  12. 12

    jquery 및 Ajax를 사용하여 중첩 된 JSON 구문 분석

  13. 13

    Angular : FormArray를 사용하여 개체 배열에 중첩 된 ngFor

  14. 14

    Android에서 중첩 된 JSON 배열을 구문 분석하는 방법

  15. 15

    각도를 사용하여 Json 객체에서 Json 배열을 구문 분석하는 방법

  16. 16

    Gson을 사용하여 중첩 배열로 JSON 구문 분석

  17. 17

    VBA 및 JSON을 사용하여 중첩 배열 구문 분석

  18. 18

    중첩 된 Json 객체를 구문 분석하고 Android의 데이터베이스에 저장

  19. 19

    UDF를 사용하여 PySpark Dataframe에서 중첩 된 XML 필드 구문 분석

  20. 20

    자바에서 중첩 된 JSON 배열 구문 분석

  21. 21

    JAXB를 사용하여 Java에서 중첩 된 XML 객체 목록을 어떻게 구문 분석 할 수 있습니까?

  22. 22

    Javacript에서 JSON 객체를 구문 분석하여 배열 생성

  23. 23

    Jackson 2.0을 사용하여 JSON 객체 배열 구문 분석

  24. 24

    json.net-중첩 된 객체를 구문 분석 할 수 없음

  25. 25

    당신은 어떻게 처리 JSON 객체를 사용하여 다음과 같은 중첩 된 JSON 파일을 구문 분석합니까?

  26. 26

    Axios 및 Async / Await를 사용하여 중첩 된 JSON 구문 분석

  27. 27

    중첩 된 "목록"과 함께 .NET deserialize ()를 사용하여 JSON 구문 분석

  28. 28

    자바 스크립트를 사용하여 중첩 된 JSON 구문 분석

  29. 29

    Android 용 RetroFit을 사용하여 중첩 된 JSON 구문 분석

뜨겁다태그

보관