how to select an element of a ng-repeat by code

1

friends I need to please help me with the following,

<select ng-model="estructura.organiza.superior" class="form-control" required>
	<option ng-repeat="puesto in Puestos" selected="{{sup}}"
				value="{{puesto.value}}">
		{{puesto.title}}
	</option>
	</select>

and I need it to show an element of the specific list, in the $ scope.sup I already have the value as I can achieve it, the behavior is strange since sometimes it shows the correct element and sometimes the first element of the list shows nothing

    
asked by CristianBonk 16.03.2018 в 17:06
source

1 answer

1

my fix is a list of a query to the base, for the case it does not matter with any type of fix, looking for the solution:

<select ng-model="estructura.organiza.superior" class="form-control" required>
										<option ng-repeat="puesto in Puestos" ng-selected="{{puesto.value==sup}}"
												value="{{puesto.value}}">
												{{puesto.title}}
										</option>
									</select>

the logic was there but the syntax was right, now if it works perfect for someone to serve him, asludos

    
answered by 16.03.2018 / 19:40
source