File

src/lib/directives/array/form-array-item-restore-button.directive.ts

Extends

FormArrayItemButton

Implements

AfterViewInit OnDestroy

Metadata

Index

Properties
Methods
HostBindings
HostListeners

HostBindings

disabled
Type : boolean
Inherited from FormArrayItemButton
type
Type : string
Default value : 'button'
Inherited from FormArrayItemButton

HostListeners

click

Methods

onClick
onClick()
Decorators :
@HostListener('click')
Inherited from FormArrayItemButton
Returns : void
updateDisplayStyle
updateDisplayStyle()
Inherited from FormArrayItemButton
Returns : void

Properties

Protected deletedControl
Type : RxapFormControl<boolean>
Inherited from FormArrayItemButton
Protected formArray
Type : RxapFormArray
Inherited from FormArrayItemButton
Protected formGroup
Type : RxapFormGroup<literal type>
Inherited from FormArrayItemButton
type
Type : string
Default value : 'button'
Decorators :
@HostBinding('type')
Inherited from FormArrayItemButton
import {
  AfterViewInit,
  Directive,
  HostListener,
  OnDestroy,
} from '@angular/core';
import { FormArrayItemButton } from './form-array-item-button';

// TODO : move to rxap packages
@Directive({
  selector: 'button[rxapFormArrayItemRestoreButton]',
  standalone: true,
})
export class FormArrayItemRestoreButtonDirective extends FormArrayItemButton implements AfterViewInit, OnDestroy {

  @HostListener('click')
  override onClick() {
    this.formGroup.controls.deleted.setValue(false);
  }

  override updateDisplayStyle() {
    if (this.isDeleted) {
      this.renderer.removeStyle(this.elementRef.nativeElement, 'display');
    } else {
      this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'none');
    }
  }

}

results matching ""

    No results matching ""