Change the default value of ui-select according to variable using AngularJS

0

I have the following ui-select in HTML:

Everything is working fine, but if the value is already filled in the variable, I need to select the option that is already filled as default. If you do not have it, it should appear as it is appearing now.

<ui-select required ng-model="$ctrl.nome" name="Nome" theme="bootstrap" id="nome" on-select="$ctrl.nome(buscaNome)">
    <ui-select-match  placeholder="Selecione o nome...">{{$select.selected.id + ' / ' + $select.selected.nome}}</ui-select-match>
        <ui-select-choices repeat="nome in $ctrl.nomes"
            refresh="$ctrl.loadNomes($select.search)">
        <div ng-bind-html="user.nome + ' / ' + user.sobrenome | highlight: $select.search"></div>
    </ui-select-choices>
</ui-select>
    
asked by anonymous 10.05.2018 / 20:02

0 answers