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
.
Can't extract data from controller for angular-chosen
-
23-06-2022 - |
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 :
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.
Solución
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow