0

I'm trying to use the ui-select2 Angular directive, and the github repo states:

All the select2 options can be passed through the directive. You can read more about the supported list of options and what they do on the Select2 Documentation Page

I have the directive working, but am unable to pass in simple options (ie: they are ignored). For example:

html

<form>
   <input type='hidden' ui-select2='selectGenes' ng-model='selectedGene' , ng-required="true">
</form>

js

$scope.selectGenes = {
  minimumInputLength: 2,
 'ajax': {
   url: "/api/genes.json",
   dataType: 'json',
   data: function(term, page) {
     return { q: term }; 
   },
   results: function(data, page) {
       var index;
       for (index = 0; index < data.length; ++index){
           data[index].text = data[index].name2;
       };
     return { results: data };
   }
 }
};   
port5432
  • 5,889
  • 10
  • 60
  • 97

1 Answers1

0

I worked it out. The Select2 parms need to be quoted.

$scope.selectGenes = {
  'minimumInputLength': 2,
  'placeholder': 'Enter Gene',
port5432
  • 5,889
  • 10
  • 60
  • 97