I have a problem for days is that I have some select that are within a ng-repeat. I need to select one to deactivate the others but I have not achieved this with anything.
The select are within a ng-repeat which to be able to differentiate them from one another use $ index, it is noteworthy that I have a ng-repeat nested.
This is my code:
vm.inUse = [];
vm.isDisabled = function(name) {
return vm.inUse.indexOf(name) !== -1;
}
vm.update = function(index) {
if(index === vm.datoss){
return true;
}
else {
return false;
}
}
vm.yourChecker = function(index) {
vm.test = 0;
vm.cont = Object.keys(vm.mon);
for (var i = 0; i < vm.cont.length; i++) {
}
if(index === 1){
return true;
}
else {
return false;
}
angular.forEach(vm.cont, function(value){
vm.test = vm.test+ 1;
if(index === 2){
return true;
}
else {
return false;
}
});
}
<div class="col-sm-5" style="padding-left: 0; padding-right: 0">
<div class="panel panel-default panel-table be-loading" ng-class="{'be-loading-active': vm.loading_users}">
<div class="panel-heading">
Premios
<!-- <h4 class="text-right"><strong>Colecciones restantes:
<span ng-show="vm.selectedInvoice.premios_restantes > 0">{{ vm.selectedInvoice.premios_restantes }}</span>
<span ng-show="vm.selectedInvoice.premios_restantes <= 0">0</span></strong></h4>
<h5 class="text-right"><strong>Colecciones: {{ vm.form.cantidad}}</strong></h5>
-->
</div>
<div class="panel-body">
<table class="table table-striped table-hover">
<thead>
<tr>
</tr>
</thead>
<tbody>
<tr ng-repeat-start="premio in vm.gifts track by premio[0].tipo.id" ng-repeat-end>
<td class="cell-detail" style="text-align: center; cursor:pointer;">
{{premio[0].tipo.tipo}}
{{vm.test1}}
</td >
<td class="cell-detail" style="text-align: center; cursor:pointer;">
<ol class="nya-bs-select" size="6" title="No seleccionado" style="padding:0; width: 100%"
ng-disabled="vm.estado === false || vm.yourChecker($index) || vm.isDisabled($index)"
ng-model="vm.form.selects.premio[$index]"
ng-change="vm.update($index)"
required>
<li nya-bs-option="option in premio" data-value="option.id" >
<a ng-click="vm.logP(option.id, option.tipo.tipo, option.opcion_premio, option.tipo.valor);">
{{option.opcion_premio}}
</a>
</li>
</ol>
</td>
</tr>
</tbody>
</table>
</div>
That's what I've tried in different ways but I do not succeed, help please