Every time I click on a button, only the last one is selected. How can I ensure that only one button gets selected at a time?
component.html
<input type="button" (click)="someFunction(categoryInput.value)" value="click me too" />
<div id="categorybox">
<tr class="categories" *ngFor="let category of categories">
<td>
<input type="radio" id={{category.categoryName}} [(ngModel)]=selectedCategory name="category" value="{{category}}" (click)=selectCategory(category)/>
<label for ={{category.category}} >{{category.categoryName}}</label>
</td>
</tr>
component.ts
export class HomeComponent implements OnInit {
page= 0;
home: Home[];
categories: Category[];
selectedCategory: Category;
selectCategory (category) {
console.log(category.category);
// do something here
// this.selectedCategory will be the selected value
// the category will be the value that was just selected
}