Pregunta

I need to use angular-chosen to customize a drop-down of groups for a project. I use resource to share the data between the controllers. I am able to extract the group list to $scope.allgroups of my controller. The console.log shows me this image :

http://i.imgur.com/QFyE3Zq.png

In my html, I do call the select in the following way but It always shows "No Group Found.." even with matching characters.

<select
    chosen multiple style="width:150px;" id="newusergroups"
    class="groupselect" title="Groups"
    allow-single-deselect="true"
    data-placeholder="Select Group.."
    no-result-text="No Such Group.."
    ng-model="selectedgroup"
    ng-options="pergroup.name for pergroup in allgroups">
    <option value=""></option>
</select>

Anywhere I am wrong? Please help.

¿Fue útil?

Solución

If the screenshot shows the console.log of allgroups, then your ng-options should be ng-options="pergroup.name for pergroup in allgroups.result", OR allgroups = $myResource.result.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top