checkbox inside ngFor, only first checkbox is getting selected & deselected everytime when clicking any other checkbox
Check value for name
, you've used different for each element: num.value
. This should be the same so that it works:
<div *ngFor="let num of count" class="m-b-20">
<div class="checkbox"> <input type="checkbox" name="checkbox-list" [(ngModel)]="num.checked" (click)="clicked(num)" ngDefaultControl/>
<label for="check"></label> </div>{{num.checked}}
</div>
checkbox-list is the new name
checkbox inside ngFor, only first checkbox is getting selected & deselected everytime when clicking any other checkbox
Check value for name
, you've used different for each element: num.value
. This should be the same so that it works:
<div *ngFor="let num of count" class="m-b-20">
<div class="checkbox"> <input type="checkbox" name="checkbox-list" [(ngModel)]="num.checked" (click)="clicked(num)" ngDefaultControl/>
<label for="check"></label> </div>{{num.checked}}
</div>
checkbox-list is the new name
Related Topics
React-Select:Get Default Value in React-Select
Removing Currency Symbol and Replacing Comma With Point Using Pure JavaScript
Why New Date().Toisostring() Is Loosing Timezone
React Display Line Breaks from Saved Textarea
Prevent CSS Tooltip from Going Out of Page/Window
Why Am I Getting Undefined as an Answer When Fetching Data from an API
How to Prevent Drag on a Child, But Allow Drag on the Parent
How to Make Any Hovered Color Darker/Lighter That the Original
How to Remove All Li Element of Same Class Except First Li Element in Jquery or JavaScript
Disable Scrolling When Touch Moving Certain Element
Angular 2 Not Updating Until Any Object Is Clicked
How to Check If Checkbox Is Checked With Protractor, Cucumberjs and Chai
How to Get List of All Timezones in JavaScript
Regex to Replace Multiple Spaces With a Single Space
Cannot Set Property ... Which Only Has Getter (Javascript Es6)
Generate a Weighted Random Number
How to Convert Image to Byte Array Using JavaScript Only to Store Image on SQL Server