Display html element from JSON object on ionic App

I have been trying to embed html element from JSON object, and It is currently displaying the html as raw code instead.

Can someone please help me ?


this.questionsData[i].question_type.title = "<ion-input type=\"text\" placeholder=\"Short answer\"></ion-input>";


<ion-item  *ngFor="let question of questionsData">
      Text : {{question.question_type.title}}
     <div   [innerHTML]="question.question_type.title">

Isn’t it should be input box under the text : , anyone know why it’s not rendered ?


Yes, but it’s a very long story and you’re not going to like the ending, which is “you’re bettter off rethinking the design”. I suggest something along these lines and/or this.

1 Like