0

Is it possile to validate the nested components form, if I have the next code?

@Component({
  selector: 'app-parent',
  template: `
    <form novalidate #form="ngForm" (ngSubmit)="validateForm(form)">
    ...
    </form>
    
    <router-outlet></router-outlet>
  `
});
export class AppParentComponent {
  constructor() {}
}


@Component({
  selector: 'app-child',
  template: `
    <form novalidate>
      <input type="text" required maxlength="80" />
    </form>
  `
});
export class AppChildComponent {
  constructor() {}
}

In the <router-outlet> I have the child component. So the idea is to validate the parent component, dependent on the fields filled in the childComponent.

Hope you help!)

SashaSemanyuk
  • 357
  • 6
  • 20

0 Answers0