File
Metadata
selector |
app-input |
styleUrls |
input.component.scss |
templateUrl |
input.component.html |
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
|
isActive
|
isActive: boolean
|
Default value: false
|
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);
}
}
}