Selected combo component

1

I'm having a problem loading the screen with a selected combo item. I've tried with jQuery, angled and it did not work. I already researched other answers here and none of the alternatives worked. Anyone have any idea what it might be?

    <div class=" form-group col-md-3">
       <label class="lb">A Rendimento</label> 
         <select  ng-change="selecionaArendimento(nota.flagARendimento)" id="flagRendimento"  ng-model="nota.flagARendimento" class="form-control">
              <option  ng-selected="selected" value="0">Não</option>
              <option value="1" >Sim</option>                 
         </select>
      </div>      
    
asked by anonymous 18.06.2018 / 13:49

2 answers

1

ng-selected must be a logical expression, it can be done like this:

<select  ng-change="selecionaArendimento(nota.flagARendimento)"  ng-model="nota.flagARendimento" class="form-control">
  <option ng-selected="nota.flagARendimento == '0'" value="0">Não</option>
  <option ng-selected="nota.flagARendimento == '1'" value="1">Sim</option>                 
</select>
    
18.06.2018 / 14:38
0

You have to compare in% w / o% w / o% w /

<option ng-selected="nota.flagARendimento == 0" value="0">Não</option>
<option ng-selected="nota.flagARendimento == 1" value="1">Sim</option>

And I believe that you can remove ng-selected from option , by specifying nota.flagARendimento it should already update what you set in ng-change with the new value selected, in this case select .

What you should do is call the function ng-model when ng-model changes.

    
18.06.2018 / 14:37