I have a code snippet as shown below.Here I have put only 2 sections.I do have six such sections in my html
file.Starting from here <div *ngIf="questionSubNumber=='a'">
is repeating part.So I need to put that into a generic template where I can use that when I need it.Can you tell me a better approach for this? I have to pass dynamic data like questionNumber
,groupQuestion?.description
etc into that template too.
.html
<div *ngIf="question?.type=='date' && !isSurveyDone && isShow">
<div *ngIf="questionSubNumber=='a'">//need to put this into template
<ion-list>
<ion-list-header text-wrap>
<span class="number">{{questionNumber}}</span> {{groupQuestion?.prompt}}
<div class="description">{{groupQuestion?.description}}</div>
</ion-list-header>
</ion-list>
</div>//need to put this into template
<ion-list>
<ion-list-header text-wrap>
//other html code
</ion-list>
</div>
<div *ngIf="question?.type=='textfield' && !isSurveyDone && isShow">
<div *ngIf="questionSubNumber=='a'">
<ion-list>
<ion-list-header text-wrap>
<span class="number">{{questionNumber}}</span> {{groupQuestion?.prompt}}
<div class="description">{{groupQuestion?.description}}</div>
</ion-list-header>
</ion-list>
</div>
<ion-list no-lines>
//more html
</ion-list>
</div>
questionSubNumber
?