Struggling to incorporate radio buttons into my project, I encountered an issue where the first radio button couldn't be checked programmatically.
Despite attempting the suggested Solution, it didn't resolve the problem within my code.
Below is the snippet of my radio button implementation:
<div class="col-sm-3 col-form-label" style="padding-right: 0px;">
<input type="radio" value=1 [checked]="actionUpload == 1" name="uploadAction" [(ngModel)]="actionUpload" (ngModelChange)="choose(1)"> Radio 1
<input type="radio" value=2 [checked]="actionUpload == 2" name="uploadAction" [(ngModel)]="actionUpload" (ngModelChange)="choose(2)"> Radio 2
</div>
Attached is a peek into my Typescript code:
export class Component implements OnInit {
actionUpload:number = 1
constructor() {
//some code here
}
ngOnInit() {
//some code here
}
choose(upT:number){
this.actionUpload = upT
}
}
Despite the efforts, the first radio button remains unchecked as per the outcome depicted:
https://i.sstatic.net/3gmy3.png
Any guidance or assistance would be greatly appreciated.