Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

'Ionic way' of rendering JSON into HTML

$
0
0

@pp1994 wrote:

I have a couchDB instance which will return JSON:

[
{date: "01/01/2015", New : "hello there", Old : "bye"},
{date: "01/02/2015", Spam: "data", New : "hello again}
]

I need to loop through each object in the JSON and render such that the keys in the JSON objects are headers, and the values of the JSON objects are subvalues:

<div class="card">
  <div class="item item-divider">
    01/01/2015
  </div>
  <div class="item item-text-wrap">
    <b>New</b><br />
    hello there. <br />
    <b>Old</b><br />
    bye <br />
  </div>
</div>
<div class="card">
  <div class="item item-divider">
    02/01/2015
  </div>
  <div class="item item-text-wrap">
    <b>Spam</b><br />
    data <br />
    <b>New</b><br />
    hello again <br />
  </div>
</div>

I have full control over the source of JSON (reduces risk of XSS).

Is what I am trying to do possible? What is the best way to achieve this?

I have been messing around directives so far.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>