<div *ngFor="let bookData of allBookData.books">
<input #bookArray type="checkbox" id="bookArray " name="bookArray " class="form-control" value="bookData.bookname" checked="bookData.book_id == 3"> {{bookData.bookname}}
</div>
I have 3 books in allBookData
book_id :1 bookname: The Magician
book_id :2 bookname: Rainbow Behind Tree
book_id :3 bookname: Mr Romeo
So now I want the Mr Romeo flag to be checked with book id == 3 , but all the flags are checked . I think my condition in checked = "" is wrong. What is the right condition I have to make there.
I tried this too
checked ="bookData.book_id == 3 ? true : false"
still not working.
source
share