I've recently upgraded from angular 1.1.4 up to 1.2.9, and grabbed the latest ui-select2 directive and the latest select2 component. My select2s in tag mode have stopped working. The options list and typeahead work, but when I select anything from it, the new tag shows up as a blank thing with no value, and debugging it, I see it is getting sliced from {text: "foo", id: 10} just down to 10 - the object is being replaced with the id. I'd really appreciate any insight on why this is happening.
Demo: http://plnkr.co/edit/RepMSFQsIPDuPTNFWKUN?p=preview
Here are my select2 options:
.controller('AppController', function($scope) {
availableTags = [
{text: 'Apple', id: 1},
{text: 'Apricot', id: 2},
{text: 'Avocado', id: 3},
];
$scope.select2Options = {
tags: availableTags,
multiple: true,
minimumInputLength: 1,
formatResult: function (item) {
return item.text;
},
formatSelection: function (item) {
return item.text;
},
}
Holy cow, Matt / invinity answered my question over on github issues:
https://github.com/angular-ui/ui-select2/issues/144#issuecomment-33287882
I had this same behavior and was able to correct it by changing the input type to
"hidden". See if that works for you.
-matt
This completely solved it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With