How to Retreive Data from JSon to HTML table format?

image

I need an output like above on HTML table |TR| |TD| format on IONIC view. (not ng-repeat method).
How to wrap data on json format and method to deliver to IONIC view…?

Thank You.

What do you mean by not ng-repeat method?

ng-repeat does not stop you from formatting your html as you like.

May be you should explain what you really want to do

basically im not familiar using ng-repeat, i habitual using “looping for”. but its fine if you help me to explain how to use ng-repeat to my case above. thank you

<table>
<tr ng-repeat="que in Questions>
<td colspan=“4”> {{que.Question}} </td>
<tr> <td> {{que.opt1}} </td>
<td> {{que.opt2}} </td>
<td> {{que.opt3}} </td>
<td> {{que.opt4}} </td>
</tr>
</tr>
<table>

1 Like

I dont see any reason why you should use html table if you are using ionicframework. You can use some of ionic elements and just style it using your own custom css. Below is an example:

<div ng-repeat="quest in Questions" class="list card">
     <div class="item item-text-wrap">
            {{quest.questionText}}
     </div>
       <a href="#" class="item" ng-repeat="choice in quest.choices">
               {{choice.text}}
       </a>
</div>

I hope that helps.

1 Like

Thank you so much it works.
but this is my query from json

SELECT A.no, A.pertanyaan, B.jawaban FROM tanya A
left JOIN jawab B ON A.kode=B.kode and A.kat2=B.kat2 (output, see my picture at question)

but shown error like this?

Please log your response and let me see the structure.
If you are on skype you can add me my id is adesina.mark.

But if you can add track by into your ng-repeat

<div ng-repeat="quest in Questions track by $index" class="list card">
 <div class="item item-text-wrap">
        {{quest.questionText}}
 </div>
   <a href="#" class="item" ng-repeat="choice in quest.choices  track by $index">
           {{choice.text}}
   </a>
</div>