ajax - How read .json file in angular js -


here want read .json file. have read in controller. getting while reading .json file. quiz.json:

 [  {    "data":{   "questions":{             "level":[               {                  "question":[                     {                        "title":"what sap® stand for?",                        "answer":[                           "services application programming",                           {                              "_correct":"1",                              "__text":"systems, applications, , programs"                           },                           "sino-american peace",                           "statistical analysis program"                        ]                     },                     {                        "title":"what tcode mean?",                        "answer":[                           "television code",                           "translation code",                           "transition code",                           {                              "_correct":"1",                              "__text":"transaction code"                           }                        ]                     },  } } ] 

i tried read got unexpected token /. can suggest how read it?

the json posted incorrect.

this format needs their:

json:

$scope.questions = [  {    "data":{   "questions":{             "level":[               {                  "question":[                     {                        "title":"what sap® stand for?",                        "answer":[                           "services application programming",                           {                              "_correct":"1",                              "__text":"systems, applications, , programs"                           },                           "sino-american peace",                           "statistical analysis program"                        ]                     },                     {                        "title":"what tcode mean?",                        "answer":[                           "television code",                           "translation code",                           "transition code",                           {                              "_correct":"1",                              "__text":"transaction code"                           }                        ]                     }                  ]                }              ]            }          }        }      ]; 

and html used traverse json in angular:

<div ng-app>     <div ng-controller = "test">         <div ng-repeat="data1 in questions">             <div ng-repeat="question in data1.data.questions.level">                     <div ng-repeat="levelquest in question.question">                         {{levelquest.title}}                 </div>             </div>         </div>     </div> </div> 

working demo


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -