Display JSON data in paragraph


#1

Hey i am getting data from a JSON URL, this is my sample data,


I want to display all “text” in a paragraph,like

" بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ لْحَمْدُ لِلَّهِ رَبِّ الْعَالَمِينَ الرَّحْمَٰنِ الرَّحِيمِ "

I am using ngFor. Please help… Thank You


#2
<ion-list>
  <ion-item *ngFor="let ayah of ayahs">
    {{ayah.text}}
  </ion-item>
</ion-list>

#3

I want to display data in a paragraph, by your logic data is showing like this,
image


#4

Oh, so like concat all of the text data?

In that case in the controller I’d do:

public text = "";

Then when you get the data do:

this.text = ayahs.reduce((str, ayah) => str + ayah.text, "");

Then in your template you can just do:
<p>{{text}}</p>


#5

Could you do this with my logic, i can’t understand your logic.

View on HTML:
image
TS Data:
image
I am getting my required data in "this.frest"
Sorry if i sound silly :slight_smile: