How to use *ngIf to get value in slide IONIC


#1

I’m using *ngIf in Slides to get all values of id_qtype in slides

id_qtype parameter have 5 values are:
id_qtype = 1;
id_qtype = 2;
id_qtype = 3;
id_qtype = 4;
id_qtype = 5;
When I use *ngIf as below, it seem get data incorrect

This my sources:

HTML:

<ion-slides>
<div *ngIf="myValue.id_qtype =='1'>		<!-- ;else elsetag" -->
	<ion-list radio-group>
		<ion-item no-lines no-padding class="mark_answer_inside">
			<ion-label>① <div class="mark_answer" [innerHTML]= "myValue.ex1"></div></ion-label>                                
		</ion-item>							  
		<ion-item no-lines no-padding>
			<ion-label>② <div class="mark_answer" [innerHTML]= "myValue.ex2"></div> </ion-label>                  
		</ion-item>
    </ion-list>
</div>

<div *ngIf="myValue.id_qtype =='2'>		
	<ion-list radio-group>
		<ion-item no-lines no-padding class="mark_answer_inside">
			<ion-label>① <div class="mark_answer" [innerHTML]= "myValue.ex1"></div></ion-label>                                
		</ion-item>							  
		<ion-item no-lines no-padding>
			<ion-label>② <div class="mark_answer" [innerHTML]= "myValue.ex2"></div> </ion-label>                  
		</ion-item>
    </ion-list>
</div>

<div *ngIf="myValue.id_qtype =='3'>		
	<ion-list radio-group>		
		<ion-item no-lines no-padding>
			<ion-label>② <div class="mark_answer" [innerHTML]= "myValue.ex2"></div> </ion-label>                  
		</ion-item>
    </ion-list>
</div>

<div *ngIf="myValue.id_qtype =='4'>		
	<ion-list radio-group>
		<ion-item no-lines no-padding class="mark_answer_inside">
			<ion-label>① <div class="mark_answer" [innerHTML]= "myValue.ex1"></div></ion-label>                                
		</ion-item>							  
		<ion-item no-lines no-padding>
			<ion-label>② <div class="mark_answer" [innerHTML]= "myValue.ex2"></div> </ion-label>                  
		</ion-item>
    </ion-list>
</div>

<div *ngIf="myValue.id_qtype =='5'>		
	<ion-list radio-group>
		<ion-item no-lines no-padding class="mark_answer_inside">
			<ion-label>① <div class="mark_answer" [innerHTML]= "myValue.ex1"></div></ion-label>                                
		</ion-item>							  		
    </ion-list>
</div>
<ion-slides>

How to get correct value when id_qtype = 1 or 2 or 3 or 4 or 5 in slides ?

Thank so much !!


#2

did you check your code?
There are missing " (quotes) in each line that has ngIf.

It should be like this.

<div *ngIf="myValue.id_qtype =='2'">		
	<ion-list radio-group>
		<ion-item no-lines no-padding class="mark_answer_inside">
			<ion-label>① <div class="mark_answer" [innerHTML]= "myValue.ex1"></div></ion-label>                                
		</ion-item>							  
		<ion-item no-lines no-padding>
			<ion-label>② <div class="mark_answer" [innerHTML]= "myValue.ex2"></div> </ion-label>                  
		</ion-item>
    </ion-list>
</div>

<div *ngIf="myValue.id_qtype =='3'">		
	<ion-list radio-group>		
		<ion-item no-lines no-padding>
			<ion-label>② <div class="mark_answer" [innerHTML]= "myValue.ex2"></div> </ion-label>                  
		</ion-item>
    </ion-list>
</div>

<div *ngIf="myValue.id_qtype =='4'">		
	<ion-list radio-group>
		<ion-item no-lines no-padding class="mark_answer_inside">
			<ion-label>① <div class="mark_answer" [innerHTML]= "myValue.ex1"></div></ion-label>                                
		</ion-item>							  
		<ion-item no-lines no-padding>
			<ion-label>② <div class="mark_answer" [innerHTML]= "myValue.ex2"></div> </ion-label>                  
		</ion-item>
    </ion-list>
</div>

<div *ngIf="myValue.id_qtype =='5'">		
	<ion-list radio-group>
		<ion-item no-lines no-padding class="mark_answer_inside">
			<ion-label>① <div class="mark_answer" [innerHTML]= "myValue.ex1"></div></ion-label>                                
		</ion-item>							  		
    </ion-list>
</div>