i have select
item i'm populating using ng-repeat
in option
. use angular's data binding set value of selected item model. reason " in json string turned \" . because of can't reach attributes in json string anymore later on in code.
<select id="concepts" class="form-control" ng-model='usecase.concepts' multiple title='-select 1 or more primary concepts-' data-width="auto" > <option ng-repeat='concept in concepten' value='{{concept}}'>{{concept.name}}</option> </select>
concept json string looks this:
{"name":"concept1","description":"beschrijving"}
but when select item in select looks this:
{\"name\":\"concept1\",\"description\":\"beschrijving\"}
i later on want fill dropdowns name attribute of chosen concepts, can't reach name attribute anymore because of backslash. how can fix value
doesn't add backslashed json string?
remark: works using ng-options
instead of ng-repeat
, i'm trying use nya-bootstrap-select can't work ng-options
tag
i not recommend put whole json-strings value in select. if description contains more text / html might run trouble. might better set selected concepts in change handler like:
ng-change="updateselectedconcepts()"
http://plnkr.co/edit/4etrflm0hrftaobtyvts?p=preview
in plunkr can see, usecase.concepts
contains selected concepten-objects.