### File

`src/lib/directives/form-control-mark-dirty.directive.ts`

### Metadata

Selector | `[rxapFormControlMarkDirty]`
Standalone | `true`

### Index

###### Methods

- Public onClick

###### HostListeners

- click

### Constructor

`constructor(parent: ControlContainer)`
Defined in src/lib/directives/form-control-mark-dirty.directive.ts:12

Parameters :

Name | Type | Optional
parent | `ControlContainer` | No

### HostListeners

click
Defined in src/lib/directives/form-control-mark-dirty.directive.ts:18

### Methods

Public onClick
`onClick()`
Decorators : `@HostListener('click')`
Defined in src/lib/directives/form-control-mark-dirty.directive.ts:18
Returns : `void`

    import {
      Directive,
      HostListener,
    } from '@angular/core';
    import { ControlContainer } from '@angular/forms';
    import { hasIndexSignature } from '@rxap/utilities';

    @Directive({
      selector: '[rxapFormControlMarkDirty]',
      standalone: true,
    })
    export class FormControlMarkDirtyDirective {

      constructor(private readonly parent: ControlContainer) {
      }

      @HostListener('click')
      public onClick() {
        const control = this.parent.control;

        if (control && hasIndexSignature(control) && typeof control['markAllAsDirty'] === 'function') {
          control['markAllAsDirty']();
        } else {
          control?.markAsDirty();
        }

      }

    }

# results matching ""

# No results matching ""