X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fforms%2Fpeertube-checkbox.component.ts;h=a4b72aa37ad0c3c50bb521db0e8076f49c5e7b8f;hb=8e8eb2614b4e6be90ea5cf2f7347f1eb40f28932;hp=c1a6915e8613c901ef780a237411d1cb46c4604e;hpb=88108880bbdba473cfe36ecbebc1c3c4f972e102;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/forms/peertube-checkbox.component.ts b/client/src/app/shared/forms/peertube-checkbox.component.ts index c1a6915e8..a4b72aa37 100644 --- a/client/src/app/shared/forms/peertube-checkbox.component.ts +++ b/client/src/app/shared/forms/peertube-checkbox.component.ts @@ -1,4 +1,4 @@ -import { Component, forwardRef, Input } from '@angular/core' +import { ChangeDetectorRef, Component, forwardRef, Input, OnChanges, SimpleChanges } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' @Component({ @@ -19,12 +19,22 @@ export class PeertubeCheckboxComponent implements ControlValueAccessor { @Input() labelText: string @Input() labelHtml: string @Input() helpHtml: string + @Input() helpPlacement = 'top' @Input() disabled = false + // FIXME: https://github.com/angular/angular/issues/10816#issuecomment-307567836 + @Input() onPushWorkaround = false + + constructor (private cdr: ChangeDetectorRef) { } + propagateChange = (_: any) => { /* empty */ } writeValue (checked: boolean) { this.checked = checked + + if (this.onPushWorkaround) { + this.cdr.markForCheck() + } } registerOnChange (fn: (_: any) => void) {