Я создаю тестовое приложение, используя angular5, поэтому мне нужно получить флажок с проверкой, хранящейся в Mongodb.
Below i have written query to get checkbox from mongodb. I get checkboxes with name directly to browser from mongodb, but i am not able to get with check(tickmark).
so what is the exact procedure for changes need to be done in query. In my code i wrote edituserdetails is for edit the selected user.When i click on edit button i get the details of selected user but i am not able to get tick mark for the checkboxes. here i use 10 interests on TS file.
I send 4 interests to mongodb. How to get that 4 interests to browser with checked(tick mark) and remaining 6 interests are live in browser with unchecked(untick).
Это мой HTML-код.
<h5>Please choose your speciality of Interest</h5>
<div class="interests-list col-md-12">
<li class="int-list col-md-3" *ngFor="let interest of editUserDetails.basics[0].interest;let i = index;">
<input type ="checkbox" name="interest" style="margin-top: 6px;" [(ngModel)]="interest.checked"
><span class="int-n">{{interest}}</span>
</li>
</div>
это мой файл TS
interests=[
{value: 'AGING-0', name: 'AGING', id:"1"},
{value: 'AIDS-1', name: 'AIDS', id:"2" },
{value: 'ALCOHOLISM-2', name: 'ALCOHOLISM' ,id:"3" },
{value: 'ALLERGY-3', name: 'ALLERGY' ,id:"4" },
{value: 'ALTERNATIVE MEDICINE-3', name: 'ALTERNATIVE MEDICINE', id:"5"},
{value: 'ANAESTHESIA-4', name: 'ANAESTHESIA',id:"6"},
{value: 'ANATOMY-5', name: 'ANATOMY',id:"7" },
{value: 'ANGIOLOGY-6', name: 'ANGIOLOGY' ,id:"8"},
{value: 'APOPTOSIS-7', name: 'APOPTOSIS' ,id:"9"},
{value: 'ANAESTHESIA-8', name: ' ANAESTHESIA' ,id:"10"}
]
мои данные базы данных монго
basics: Array
0:Object
name:"xxxxx"
address:"xxxxx"
city:"xxxxx"
interest:Array
0:"Aging"
1:"Aids"
2:"Alcoholism"
3:"Allergy"