I have app build on mongodb and angular. In page i have 3 checkboxes like:
<input type="checkbox" ng-model="user.profile.dog"/>Dog</label>
<input type="checkbox" ng-model="user.profile.cat"/>Cat</label>
<input type="checkbox" ng-model="user.profile.mouse"/>Mouse</label>
when i check and press save, data are saved in mongodb and it looks like: dog: "true", cat: "true",
etc.
problem is that when i reload page, non of checkboxes are checked.
when i manually change values in mongodb to boolean like: dog: true, cat: true,
etc. and reload page, checkboxes are checkhed.
What is the proper solution? Convert string to boolean on save or something else?
Aucun commentaire:
Enregistrer un commentaire