Control Components Children Angular 2+

0

I need to create a component that controls other components, the idea is to set up a parent component (grid-component) that controls the child component (user-form-component). Something like this:

<grid-component>

    <user-form-component></user-form-component>

</grid-component>

The grid itself already renders a table and as you click on the precise line to mount a modal with the component it passes, in this case it is the user-form-component, but I have 4 other forms that need to be done like this

Problem 1- Child component manipulation : Since the components are not known, I can not use @ViewChild(UserFormComponent) modal: UserFormComponent; because another component will be another component

Problem 2- Sending information between components : I can not use <ng-content></ng-content> to manipulate because I need to send data to the form in <user-form-component> to mount user registration or user form;

Problem 3- Who manages modal : I'm not sure if <user-form-component> should contain modal in it or only form and in <grid-component> have modal with content <user-form-component> / p>     

asked by anonymous 30.01.2018 / 21:01

0 answers