From 2e257e36b78b6f6b842f5ed8b4c79514e6e3a208 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 24 Mar 2021 10:58:36 +0100 Subject: Add client action hooks for pubish pages --- .../app/shared/shared-forms/select/select-options.component.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'client/src/app/shared/shared-forms/select/select-options.component.ts') diff --git a/client/src/app/shared/shared-forms/select/select-options.component.ts b/client/src/app/shared/shared-forms/select/select-options.component.ts index 2890670e5..8482b9dea 100644 --- a/client/src/app/shared/shared-forms/select/select-options.component.ts +++ b/client/src/app/shared/shared-forms/select/select-options.component.ts @@ -1,4 +1,4 @@ -import { Component, forwardRef, Input } from '@angular/core' +import { Component, forwardRef, HostListener, Input } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' import { SelectOptionsItem } from '../../../../types/select-options-item.model' @@ -26,6 +26,13 @@ export class SelectOptionsComponent implements ControlValueAccessor { propagateChange = (_: any) => { /* empty */ } + // Allow plugins to update our value + @HostListener('change', [ '$event.target' ]) + handleChange (event: any) { + this.writeValue(event.value) + this.onModelChange() + } + writeValue (id: number | string) { this.selectedId = id } -- cgit v1.2.3