Component select disabled and angular selected value

2

I have the following situation

I have a select county component

<div class="form-group col-md-4">
    <label>Entidade:</label> 
        <select ng-model="distrito.entidade.idEntidade" class="form-control">
            <option value="{{dis.entidade.idEntidade}}" ng-repeat="dis in distritos">{{dis.entidade.nome}}</option>
        </select>
</div>

I need this select to be fixed with the option selected and disabled. In case the user can see the entity but does not change it.

    
asked by anonymous 03.10.2017 / 14:17

1 answer

1

Just use the ng-disabled directive.

How would your code look like:

<div class="form-group col-md-4">
<label>Entidade:</label> 
    <select ng-disabled="true" ng-model="distrito.entidade.idEntidade" class="form-control">
        <option value="{{dis.entidade.idEntidade}}" ng-repeat="dis in distritos">{{dis.entidade.nome}}</option>
    </select>
</div>
    
03.10.2017 / 14:27