import { NgIf } from '@angular/common'; import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, inject, } from '@angular/core'; import { FormControl, ReactiveFormsModule } from '@angular/forms'; import { HttpService } from './http.service'; @Component({ selector: 'app-input', standalone: true, imports: [ReactiveFormsModule], template: ` `, changeDetection: ChangeDetectionStrategy.OnPush, }) export class InputComponent { title = new FormControl('', { nonNullable: true }); } @Component({ selector: 'result', standalone: true, template: `
Title is {{ title }}
`, changeDetection: ChangeDetectionStrategy.OnPush, }) export class ResultComponent { @Input() title = ''; } @Component({ selector: 'app-button', standalone: true, template: ``, changeDetection: ChangeDetectionStrategy.OnPush, }) export class ButtonComponent { @Output() validate = new EventEmitter(); } @Component({ selector: 'app-error', standalone: true, template: `Title is required !!!
`, changeDetection: ChangeDetectionStrategy.OnPush, }) export class ErrorComponent { @Output() validate = new EventEmitter(); } @Component({ selector: 'app-child', standalone: true, imports: [ ResultComponent, ButtonComponent, InputComponent, ErrorComponent, NgIf, ], template: `