Skip to content
This repository was archived by the owner on Aug 7, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/oui-select/src/select.controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { addBooleanParameter } from "@ovh-ui/common/component-utils";
import get from "lodash/get";

export default class {
constructor ($attrs, $compile, $element, $scope, $timeout) {
Expand Down Expand Up @@ -59,4 +60,8 @@ export default class {

this.onFocus();
}

getPropertyValue (item) {
return get(item, this.match, null);
}
}
2 changes: 1 addition & 1 deletion packages/oui-select/src/templates/match.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</span>
<span class="ui-select-match-text"
ng-hide="$select.isEmpty()"
ng-bind-html="$select.selected[$ctrl.match] || $select.selected">
ng-bind-html="$ctrl.getPropertyValue($select.selected) || $select.selected">
Copy link
Contributor

@AxelPeter AxelPeter Jan 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@radireddy Since getPropertyValue can return a default value with get, maybe we should go with;

ng-bind-html="$ctrl.getPropertyValue($select.selected)"

and

    getPropertyValue (item) {
        return get(item, this.match, item);
    }

What do you think ?

</span>
<span class="oui-icon oui-icon-chevron-down"></span>
</span>
Expand Down