I have data as :
selected : { id : <string,a task id>, description = <string> };
tasks = [ { id : 'a', value : 'Apple' }, { id : 'b', value : 'Ball' },
// more items;
];
now i want to use select2 such as variable bind to select2 should contain only the id, not the whole object
so if i select Ball, the selected should be { id : 'b', description : 'some_desc' }
<ui-select ng-model="selected.id">
<ui-select-match placeholder="select name ">{{ $select.selected.value }}</ui-select-match>
<ui-select-choices repeat="type in tasks | filter: $select.search">{{type.value}}</ui-select-choices>
</ui-select>
How do i achieve to have only string as selected value not the whole object.
EDIT : here is the example plunker http://plnkr.co/edit/onmP7FKIa7MpXsRnH025?p=preview
In which selected.sel is an object not a string. i want selected.sel should be a string always that is the code of conntry