Skip to content
Evgenii Koriakin edited this page Aug 27, 2016 · 10 revisions

Summary

The value of the component.
The field contains a selected item. A user can also type custom text. In this case if the text does not correspond to any item in the list, then a new object will be set as value, when the user focuses out from the component. If the user enters custom text, value object will contain two fields which names are taken from itemValueField and itemTextField parameters. E.g., if itemValueField equals to "id" and itemTextField - to "name", then the object will be as follows:

{
    id: '',
    name: ''
}

Default value

Value: null

Returns

Type: Object

Examples

Sets value field:

HTML:

<eq-combo-box #fabricsComboBox
    [value]="fabric">
</eq-combo-box>

TypeScript:

export class AppComponent {
    @ViewChild('fabricsComboBox') fabricsComboBox: EqwadComboBox;
    fabric = {
        id: '2',
        name: 'Polyester'
    };
}

Gets value field:

HTML:

<eq-combo-box #fabricsComboBox
    [value]="fabric">
</eq-combo-box>

TypeScript:

export class AppComponent {
    @ViewChild('fabricsComboBox') fabricsComboBox: EqwadComboBox;
    fabric = {
        id: '2',
        name: 'Polyester'
    };

    constructor() {
        let value = this.fabricsComboBox.value;
    }
}