mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
video add to playlist component -> onpush strategy
This commit is contained in:
parent
3a0fb65c61
commit
8dfceec44a
11 changed files with 46 additions and 13 deletions
|
@ -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({
|
||||
|
@ -21,10 +21,19 @@ export class PeertubeCheckboxComponent implements ControlValueAccessor {
|
|||
@Input() helpHtml: string
|
||||
@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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue