Hi, I would like the first value of a select to be self-selected. As you will see, my code is the following, I do not know what I am doing wrong.
the HTML
<div class="row" style="display:block; margin-top:-95px" ng-controller="lista_claves">
<center>
<div class="col-xs-12">
<div class="box box-solid collapsed-box " id="oficinas" ng-repeat="item in claves">
<div class="box-header" data-widget="collapse" >
<img class="lupa" src="css/galeria/zoom.png" style="float:left; width:14px;height:18px; margin-left:2%;margin-top: 3%;" />
<h2 class="box-title" display="block" style="float:left; margin-left:2%;"> {{item.documentos}} </h2>
<img class="change" src="css/galeria/down.png" style="float:right; width:7%;margin-right: 5%; margin-top: 4%;" />
<p id="typee" value="{{item.descripcion}}"></p>
<div class="box-tools pull-right">
</div>
</div>
<div class="box-body" id="uniq" ng-controller="detalle_referenciacontrol">
<!--aqui estaba el filtro
--><select id="set" name="show-filter" ng-model="searchinput" >
<option id="plunkr" selected="selected" value="{{item.descripcion}}"></option>
</select>
<input type="text" id="twit" ng-model="searchinput" readonly value="{{item.descripcion}}" placeholder="{{item.descripcion}}" cloack />
<center>
<table class="table table-hover" style="margin:auto">
<tbody>
<tr ng-repeat="item in itemsarchivo | filter:{tipodescrip:searchinput}" id="{{item.path}}" onclick="ver(this)">
<td><b style="float:left;">{{item.nombre}}</b><img src="css/galeria/doc.png" style="float:right"></td>
</tr>
</tbody>
</table>
</center>
</div>
</div>
</div>
</center>
</div>
The code with which I try to self-select
<script>
$(document).ready (
function dialog_submit(val) {
document.getElementById('twit').value = val;
$("#uniq select").each(function () {
$("#set").val = val;
});
}
);
</script>
the items I post in the select are the following
$scope.claves = [
{
"documentos": "Sin clasificar (1)",
"clave": "0",
"descripcion": "Sin clasificar"
},
{
"documentos": "Pedimento Aduanal (3)",
"clave": "2",
"descripcion": "Pedimento Aduanal"
},
{
"documentos": "Facturas de Gastos (A cuenta de Terceros) (4)",
"clave": "3",
"descripcion": "Facturas de Gastos (A cuenta de Terceros)"
},
{
"documentos": "Cuentas de Gastos MOZ (2)",
"clave": "4",
"descripcion": "Cuentas de Gastos MOZ"
},
{
"documentos": "COVE (4)",
"clave": "5",
"descripcion": "COVE"
},
{
"documentos": "Facturas de Mercancías (Compra de Mercancias) (1)",
"clave": "6",
"descripcion": "Facturas de Mercancías (Compra de Mercancias)"
},
{
"documentos": "Guía aérea, conocimiento de embarque o carta de porte (1)",
"clave": "25",
"descripcion": "Guía aérea, conocimiento de embarque o carta de porte"
}
]