【发布时间】:2019-08-15 16:37:16
【问题描述】:
你好。我正在使用 angular 6 和 agular 材料,并且我有一个字符串数组,我在 mat-select 表单字段中显示它们。 如果用户选择一个元素,然后选择另一个元素,我需要跟踪之前的值是什么,新的值是什么。
到目前为止,我已经能够使用 $event.value 获取当前值,但我还没有找到存储或获取先前值的方法。
<mat-select placeholder="Choose..." (selectionChange) ="checkTitle($event.value);">
<mat-option *ngFor="let option of Titles; trackBy: trackByFn" [value]="option.title">
{{option.title}}
</mat-option>
</mat-select>
到目前为止,我还没有想出如何解决这个问题的任何想法。 感谢您的帮助。
【问题讨论】: