X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-forms%2Fselect%2Fselect-options.component.ts;h=8482b9deab2ed81199ca459dedd3a00c7d88e703;hb=8f608a4cb22ab232cfab20665050764b38bac9c7;hp=2890670e5cda5881109cb54a3f31487b47be147c;hpb=21e493d4d8acb7a650eff3a30cd7e086b3cb8a28;p=github%2FChocobozzz%2FPeerTube.git 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 }