I'm trying to create a list of radio buttons from categories. The categories is an array of objects like this:
[ { _id: '58cfb65b2ad6426beec93231' label: 'Category name', checked: true }, { _id: '58cfb65b2ad6426beec93232' label: 'Category name 2', checked: false } ] Now I try to render a list of radio buttons and want to set checked by the checked value.
<label *ngFor="let cat of categories"> <input type="radio" name="category" [checked]="cat.checked" [(ngModel)]="selectedCategory" [value]="cat._id"/> {{ cat.label[lang.code] }} </label> The radio buttons all come up unchecked and selectedCategory is undefined. When I submit the form and check the values it also comes out undefined... Anyone knows what im doing wrong?