I'm using angular to make a form that contains multiple checkboxes (using angular-material), this form sends the values to the controler, which are received as follows:
Ineedtogetthisdata(allobjectscontainthesamefields)andturnitintoaJSON.Doesanyoneknowhowthiscanbedone?
Mycontrollercode:
vm.cadastraGrupo=function(dados){vm.disabled=true;console.log(dados);}
MyHTML:
<formname="userForm" ng-model="vm.data" ng-submit="vm.cadastraGrupo(vm.data)">
<md-input-container class="col-xs-12 md-block">
<label>Nome</label>
<input ng-model="vm.data.nome_grupo_menu" required="">
</md-input-container>
<div class="col-md-3 col-sm-6 col-xs-12">
<label class="label_tinyMCE left_100">Leitura</label>
<md-checkbox aria-label="Select All"
ng-checked="vm.isCheckedLeitura()"
md-indeterminate="vm.isIndeterminateLeitura()"
ng-click="vm.toggleAllLeitura()"> Selecionar tudo
</md-checkbox>
<div ng-repeat="menus in vm.respostaListaMenusCadastrados">
<div style="display: none;">{{vm.data[menus.id_menu].id_menu_rel_permissao = menus.id_menu}}</div>
<input type="hidden" ng-model="vm.data[menus.id_menu].id_menu_rel_permissao">
<md-checkbox ng-checked="vm.existsLeitura(menus, vm.selectedLeitura)" aria-label="menus {{$index}}" ng-click="vm.toggleLeitura(menus, vm.selectedLeitura)" style="width: 100%;" ng-model="vm.data[menus.id_menu].read_permissao">{{menus.nome_menu_rel}}</md-checkbox>
</div>
</div>
</form>