This repository was archived by the owner on Oct 2, 2019. It is now read-only.
This repository was archived by the owner on Oct 2, 2019. It is now read-only.
setting chosen property of selected object as ngModel instead of the whole object #68
Closed
Description
I'd like to ask if the module already is capable of the following and I just haven't found how or is it not yet possible:
Referring to the demo: I'd like for the module to be able to set only the email of the selected person as ngModel value, not the whole object (email, name, age) as it does now.
As I inspected the code it seems to be impossible looking at the line 62:
var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
and the way ctrl.select
is used for both keyboard and pointer
What I'd like to propose is something closer to the ngOptions select as label for value in array
syntax in the native angular select but label
is not used in this case anyway since it's displayed using the template that is transcluded - so let's name it property as value in array
. Example:
<ui-select ng-model="person.selected" theme="select2">
<ui-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</match>
<ui-choices repeat="email as person in people | propsFilter: {name: $select.search, age: $select.search}">
<div ng-bind-html="person.name | highlight: $select.search"></div>
<small>
email: {{person.email}}
age: <span ng-bind-html="''+person.age | highlight: $select.search"></span>
</small>
</ui-choices>
</ui-select>
<p> Selected: {{ person.selected }} </p> <!-- I expect "Selected: [email protected]" instead of what it displays now: the whole object -->
Metadata
Metadata
Assignees
Labels
No labels