Validate a Select in AngulatJS

0

I need to validate 3 select with the same data array, but the select should not have the same information, I hope to explain ... I leave the code:

<select ng-model= "frmData.cena1" 
        ng-options= "cena as cena.nombre for cena in cenas track by cena.id" 
        class= "form-control">
    <option value="">--Elige el cena principal--</option>
</select>
<br>
<select ng-model= "frmData.cena2" 
        ng-options="cena as cena.nombre for cena in cenas track by cena.id" 
        class= "form-control">
     <option value="">--Elige el cena 1--</option>
 </select>
 <br>    
 <select ng-model= "frmData.cena3" 
         ng-options= "cena as cena.nombre for cena in cenas track by cena.id" 
         class= "form-control">
     <option value="">--Elige el cena 2--</option>
 </select>' 

As you can see, the selections are filled with the same arrangement, I just need that it can not be the same one selected in any of the 3

    
asked by Pedro Buccellati 05.11.2018 в 23:40
source

1 answer

0

I put the code of how I think you have to do the selects, not so put the JS is not very well as you bring the data. Try and tell me. A greeting

<select ng-model="frmData.cena1" class="form-control">
<option ng-repeat="cena as cena.nombre for cena in cenas track by cena.id" ng-value="cena.codigo">{{cena.valor}}</option>
</select>

<br>

<select ng-model="frmData.cena2" class="form-control">
<option ng-repeat="cena as cena.nombre for cena in cenas track by cena.id" ng-value="cena.codigo">{{cena.valor}}</option>
</select>

<br>

<select ng-model="frmData.cena3" class="form-control">
<option ng-repeat="cena as cena.nombre for cena in cenas track by cena.id" ng-value="cena.codigo">{{cena.valor}}</option>
</select>
    
answered by 06.11.2018 в 11:49