如何从 angular 中的 mbd-select 获取数据 4

How to get data from mbd-select in angular 4

我想使用表单从 HTML 模板中的 mdb-select 获取数据到组件打字稿。 我的 HTML 是:

<mdb-select [options]="optionsSelect" placeholder="Select Transaction" class="colorful-select dropdown-primary custom-input" (change)="getValue($event)"></mdb-select>

我的组件是:

optionsSelect: Array<any>;
this.optionsSelect = [
    { value: '1', label: 'Transaction 1' },
    { value: '2', label: 'Transaction 2' },
    { value: '3', label: 'Transaction 3' },
    { value: '4', label: 'Transaction 4' },
    { value: '5', label: 'Transaction 5' },
    { value: '6', label: 'Transaction 6' }
]

//get data of select from the html
getValue(event) {
    console.log(event);
}

请建议我应该使用哪个事件将选项值从 mdb-select 获取到我的组件中。我已经使用(更改)事件处理程序,但它的工作方式不一样。

提前致谢。

使用所选事件

<mdb-select [options]="optionsSelect" placeholder="Select Transaction" class="colorful-select dropdown-primary custom-input" (selected)="getValue($event)"></mdb-select>