0

I'm trying to read in some JSON files to HTML but the HTML characters are displaying as codes. I've tried using [innerHTML]="{{item.detail}}" but its not working, any help please?

Code sample:

            <ion-row *ngFor="let item of items; index as i;">
              <span class="txt">{{item.topic}}</span><br>
              <span class="txt">{{item.excerp}}</span><br>
              <ion-col class="q">[innerHTML] = "{{item.detail}}"<br>
                
                
1
  • 1
    Can you please reduce your code to a minimal reproducible example and provide it for others to recreate your issue? Please also review How to Ask and edit your question to conform to the guidance therein. Commented Feb 1, 2022 at 15:02

1 Answer 1

1

innerHTML is a directive

<ion-row *ngFor="let item of items; index as i;">
              <span class="txt">{{item.topic}}</span><br>
              <span class="txt">{{item.excerp}}</span><br>
              <ion-col class="q" [innerHTML] = "item.detail"></ion-col>
</ion-row>

or

<ion-row *ngFor="let item of items; index as i;">
              <span class="txt">{{item.topic}}</span><br>
              <span class="txt">{{item.excerp}}</span><br>
              <ion-col class="q" innerHTML = "{{item.detail}}"></ioncol>
</ion-row>
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks so much for the reply. the first reply fixed it. Its working now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.