0
votes

I am using Angular 4 reactive form and have created a directive (called in parent input and child input separately) to show the errors below each input field if someone write and removes the content, the error is shown below that field (a new div element is created) but now I want to show the errors in parent as well as child component when I submit the form (submit button is in parent class)

1
what you have done so far can you please provide code?Abhishek
Welcome to Stack Overflow! Please visit the help center, take the tour to see what and How to Ask.Post a Minimal, Complete, and Verifiable example of your attempt, noting input and expected output.Vasilisa

1 Answers

0
votes

Create a message service and store all the validation error message to it. Upon submit display the content if any.

Also you can keep them in separate arrays or whatsoever you like and display accordingly.

HTH