angular-ui / ui-select2

AngularJS wrapper for select2 (deprecated, use angular-ui/ui-select)
https://github.com/angular-ui/ui-select
MIT License
596 stars 443 forks source link

simple_tags should sets text not id for selection #242

Open hardywu opened 10 years ago

hardywu commented 10 years ago

In the code

        var convertToAngularModel = function(select2_data) {
          var model;
          if (opts.simple_tags) {
            model = [];
            angular.forEach(select2_data, function(value, index) {
              model.push(value.id);
            });
          } else {
            model = select2_data;
          }
          return model;
        };

model.push(value.id); makes the selection render value.id which should not be what it means by 'simple_tags'. value.text should be better here.