File

src/app/input/input.component.ts

Metadata

selector app-input
styleUrls input.component.scss
templateUrl input.component.html

Outputs

valueEmit $event type: EventEmitter

Constructor

constructor()

Methods

setState
setState(value: boolean)

Updates the popup state of the custom input component and emits the custom input value to the parent component.

Parameters :
  • value
    • Boolean representing the state of the popup.
Returns: void

Properties

isActive
isActive: boolean
Default value: false
value
value: string
import {Component, EventEmitter, OnInit, Output} from '@angular/core';

@Component({
  selector: 'app-input',
  templateUrl: './input.component.html',
  styleUrls: ['./input.component.scss']
})
export class InputComponent implements OnInit {
  isActive = false;
  value: string;
  @Output() valueEmit = new EventEmitter<string>();

  constructor() {
  }

  ngOnInit(): void {
  }

  /**
   * Updates the popup state of the custom input component and emits the custom input value to the parent component.
   * @param value - Boolean representing the state of the popup.
   */
  setState(value: boolean): void {
    const text = document.getElementById('inp') as HTMLTextAreaElement;
    this.isActive = value;
    if (value) {
      text.focus();
    } else {
      this.valueEmit.emit(text.value);
    }
  }

}

results matching ""

    No results matching ""