Skip to content

IgxOverlayService: set inputs/outputs of attached components #10865

Answered by wnvko
Timmeeeey asked this question in Q&A
Discussion options

You must be logged in to vote

Calling attach will fire contentAppended event. In the event arguments you have access to created ComponentRef and to the component you are trying to show in the overlay. Getting the component you can set any inputs or subscribe to any outputs you need like this:

    public ngOnInit(): void {
        this.overlayService.contentAppended.subscribe((e: OverlayEventArgs) => {
            const component = e.componentRef.instance as MyComponent;
            component.someInput = someValue;
            component.someOutput.subscribe(e => someSubscribtion);
        });
    }

Here is a sample project showing how to set an input to the component.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Timmeeeey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #10854 on January 19, 2022 12:08.