I have a modal-component wrapped in an *ngIf inside another component. Can i inject this component into the parent so that I can access the instance. The modal-component has a show and hide method that toggles the *ngIf flag. What is the most appropriate way to accomplish this? I dont want to use jquery or elementRef.
            Asked
            
        
        
            Active
            
        
            Viewed 97 times
        
    0
            
            
        - 
                    Not sure what you mean by inject it into it's parent? – inoabrian Jul 12 '16 at 06:00
- 
                    Do you just want access to the data available in the modal to be accessed by the parent? – inoabrian Jul 12 '16 at 06:01
- 
                    1. import modal-component in desired component code file. 2. pass the component name in 'provider' in parent component declaration. – Ravinder Kumar Jul 12 '16 at 06:46
- 
                    Please show us some code or efforts you've taken to accomplish this. – Maximilian Riegler Jul 12 '16 at 07:21
- 
                    It looks like the Viewchild api is what I am after - possible duplicate. http://stackoverflow.com/questions/36018478/getting-a-reference-to-the-child-component-in-the-parent-component.......is the viewchild an acceptable, unit testable construct? – user3689167 Jul 12 '16 at 12:23
