Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

210
Vistas
AngularJS - How to make select element have an empty option selected by default?

I have a <select> element which is filled by angular, and the options are properly displayed with the data in ctrl.servicios :

<select id="id_select_token" ng-model="ctrl.token" class="form-control input-sm"
                      ng-selected="ctrl.token == item.Clv_Servicio" 
                      ng-change="ctrl.GetPrecioToken();"
                      ng-options="item as item.Descripcion for item in ctrl.servicios track by item.Clv_Servicio">
                      <option value="">Selecciona</option>
                    </select>

The issue is, I want this select to, by default, have the <option value="">Selecciona</option> selected. I've tried to add selected="selected" to that option, but it doesn't work. I also tried, on javascript, this:

let select_token_input = document.getElementById('id_select_token');
                select_token_input.selectedIndex = 0;

But this also doesn't work, is angular overriding it?, how could I best achieve this?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda