I want to get relevant selections when radio button clicks. my relevant files are as below.
app.component.html
<div class="col-md-3">
<b>Select Catogory</b><br>
<input type="radio" name="colors" [(ngModel)]="typing" (click)= "checktype(typing)" value="Agent">Agent<br>
<input type="radio" name="colors" [(ngModel)]="typing" (click)= "checktype(typing)" value="Hospital" >Hospital
<select>
<option [(value)]="agent" *ngFor="let agent of agents">{{agent}}</option>
</select>
</div>
app.component.ts
checktype(typing){
console.log(typing)
if(typing=="Agent"){
this.agents=["amila","kasun", "ayesh"]
console.log(typing)
}else{
this.agents=["hemas","general", "Asiri"]
console.log(typing)
}
}
But when I click Agent radio button It display relevant data for Hospital radio button. I can't figure out what is the wrong with code. Any one can help me? Are there any mistakes done by me?
But when I click Agent radio button It display relevant data for Hospital radio button