Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!