Check checkbox when idItem is the same in both arrays
I have a two arrays. An array that is a set of images and an array that is a set of data.
Is there a way to check the checkbox when the IDItem in the two arrays are the same?
.html
<ul class="mdc-image-list my-image-list" style="margin-top:120px;padding-left: 10px;padding-right: 10px;"> <ng-container *ngFor="let product of items; let j = index;"> <li class="mdc-image-list__item"> <div class="mdc-image-list__image-aspect-container"> <img [src]="product.image" class="mdc-image-list__image"> </div> <div class="mdc-image-list--with-text-protection"> <div class="mdc-image-list__supporting mdc-image-list__supporting"> <span class="mdc-image-list__label">{{product.name}}</span> </div> <div class="Info"> <dx-check-box (onValueChanged)="change($event);" [value]="false"></dx-check-box> </div> </div> </li> </ng-container> </ul>
.TS
items=[ { ID:1, IDItem:1, image:"https://material-components-web.appspot.com/images/photos/2x3/3.jpg", name:"name1" }, { ID:2, IDItem:2, image:"https://material-components-web.appspot.com/images/photos/3x2/10.jpg", name:"name2" }, { ID:3, IDItem:3, image:"https://material-components-web.appspot.com/images/photos/2x3/6.jpg", name:"name3" }, ] data=[ { ID:1, IDItem:1, }, { ID:2, IDItem:2, },] change(e){ console.log(e) }
In this case, IDItem 1 and 2 are present in the items and data arrays. Is there a way for these items to mark the checkbox as checked?