0

これは私のjsonオブジェクトです。 data_options->"key"->optionsの内部でテストとテストの値をループしてチェックボックスの値に表示するにはどうすればよいですか?角度js(ng-repeat)のループを反復する

{ 
    "data": { 
     "0": { 
      "id": 2, 
      "survey_id": 14, 
      "question": "What's here?", 
      "question_type": 2, 
      "created_at": "2016-07-15 18:29:05", 
      "updated_at": "2016-07-15 18:29:05", 
      "deleted_at": null, 
      "type": "checkbox", 
      "ques_options_id": 2, 
      "key": "pqr", 
      "value": "PQR", 
      "survey_user_id": 39 
     }, 
     "1": { 
      "id": 9, 
      "survey_id": 14, 
      "question": "Whats demo? ", 
      "question_type": 4, 
      "created_at": "2016-07-15 18:29:05", 
      "updated_at": "2016-07-15 18:29:05", 
      "deleted_at": null, 
      "type": "dropdown", 
      "ques_options_id": 9, 
      "key": "checking", 
      "value": "Checking", 
      "survey_user_id": 39 
     }, 
     "2": { 
      "id": 1, 
      "survey_id": 14, 
      "question": "What's in your mind?", 
      "question_type": 1, 
      "created_at": "2016-07-15 18:29:05", 
      "updated_at": "2016-07-15 18:29:05", 
      "deleted_at": null, 
      "type": "textarea", 
      "ques_options_id": 1, 
      "key": "abc", 
      "value": "ABC", 
      "survey_user_id": 39 
     }, 
     "3": { 
      "id": 8, 
      "survey_id": 14, 
      "question": "Whats abc here?", 
      "question_type": 3, 
      "created_at": "2016-07-15 18:29:05", 
      "updated_at": "2016-07-15 18:29:05", 
      "deleted_at": null, 
      "type": "radio", 
      "ques_options_id": 8, 
      "key": "abcde", 
      "value": "ABCDEF", 
      "survey_user_id": 39 
     }, 
     "4": { 
      "id": 10, 
      "survey_id": 14, 
      "question": "Testing here?", 
      "question_type": 2, 
      "created_at": "2016-07-15 18:29:05", 
      "updated_at": "2016-07-15 18:29:05", 
      "deleted_at": null, 
      "type": "checkbox", 
      "ques_options_id": 10, 
      "key": "test", 
      "value": "Test", 
      "survey_user_id": 39 
     }, 
     "5": { 
      "id": 10, 
      "survey_id": 14, 
      "question": "Testing here?", 
      "question_type": 2, 
      "created_at": "2016-07-15 18:29:05", 
      "updated_at": "2016-07-15 18:29:05", 
      "deleted_at": null, 
      "type": "checkbox", 
      "ques_options_id": 10, 
      "key": "Testing", 
      "value": "Testing", 
      "survey_user_id": 39 
     }, 
     "data_option": { 
      "1": { 
       "options": { 
        "0": { 
         "abc": "ABC" 
        } 
       }, 
       "question": "What's in your mind?", 
       "type": "textarea" 
      }, 
      "2": { 
       "options": { 
        "0": { 
         "pqr": "PQR" 
        } 
       }, 
       "question": "What's here?", 
       "type": "checkbox" 
      }, 
      "8": { 
       "options": { 
        "0": { 
         "abcde": "ABCDEF" 
        } 
       }, 
       "question": "Whats abc here?", 
       "type": "radio" 
      }, 
      "9": { 
       "options": { 
        "0": { 
         "checking": "Checking" 
        } 
       }, 
       "question": "Whats demo? ", 
       "type": "dropdown" 
      }, 
      "10": { 
       "options": { 
        "0": { 
         "test": "Test" 
        }, 
        "1": { 
         "Testing": "Testing" 
        } 
       }, 
       "question": "Testing here?", 
       "type": "checkbox" 
      } 
     } 
    } 
} 
+0

ng-repeatの内部でng-ifを試してみてください – Subash

答えて

0

まず変換アレイへのオブジェクトと、あなたは以下のようにアレイ上NG・リピートを使用することができます:あなたはビューでこれを行うことができます

var myObj = { 
    0: { 
     "id": 1, 
     "survey_id": 12 
     }, 
    1: { 
     "id": 2, 
     "survey_id": 14 
     }, 
}; 

var array = $.map(myObj, function(value, index) { 
    return [value]; 
}); 
+0

ドロップダウン値 "10"としてテストをドロップダウン値とキーテストとして表示するには:{"op 「テスト」:「テスト」:「テスト」:「質問」:「ここでテストしますか?」、「タイプ」:「チェックボックス」: } – Deepa

0

<div ng-app="myApp" ng-controller="ListCtrl"> 
    <div ng-repeat="patient in data.data.data_option "> 
     <div ng-repeat="detail in patient.options ">   
     <input type="checkbox"> 
     <span class="done-{{todo.done}}">{{detail}}</span> 
    </div> 
</div> 

Working Application

+0

ドロップダウン値「10」としてテストを表示するにはどうすればよいですか:{ 「オプション」:{ "0":{ "テスト": "テスト" } "1":{ "テスト": "テスト" }} 、 "質問": "テストここに?"、 "タイプ": "チェックボックス" } – Deepa

+0

は、それを表示するアプリケーションをチェックし@Deepa – Sajeetharan