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

235
Views
Choices.js: Add dynamic data into the select option

I'm using Choices.js for multi select and for a select with a search box. I am also using angular.js to populate the data but it doesn't seem to work. Can anybody help me with populating the options dynamically.

The data is being retrieved using Ajax.

This is what I've tried

<label for="docno" class="col-form-label">Name :</label>
<select id='docno' class="choices form-select" ng-model="docno" ng-change='getDocs()' required="true">
     <option ng-repeat="d in documents" ng-value="d.docno" selected='selected'>{{d.name}}</option>
</select>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use setValue in choices instance like below :

var choices = new Choices(document.getGetElementById("docno"));
var myDynamicItems = [
    {
        value: 'Value 1',
        label: 'Label 1',
        id: 1
    },
    {
        value: 'Value 2',
        label: 'Label 2',
        id: 2
    }
];

inst.choices.setValue(myDynamicItems);

about 4 years ago · Juan Pablo Isaza Report
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!