]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-forms/select/select-options.component.ts
Merge branch 'develop' into shorter-URLs-channels-accounts
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-forms / select / select-options.component.ts
index 2890670e5cda5881109cb54a3f31487b47be147c..8482b9deab2ed81199ca459dedd3a00c7d88e703 100644 (file)
@@ -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
   }