Passing data to and from a ComponentPortal in Angular CDK

Discussão em 'Angular' iniciado por Ral, Novembro 11, 2024.

  1. Ral

    Ral Guest

    I have tried to use the method found at Angular CDK: How to set Inputs in a ComponentPortal but PortalInjector seems to be deprecated, with no actual instructions on what to do in its place. The deprecation warning states to "Use Injector.create instead." with but not how or where to use it or what it's actually replacing.

    I have also tried to wrap my head around Material's own Dialog component to see if I could figure out how they did it, but nothing.

    So I pose the question again for Angular 13:

    How can I pass data into and out of a component that was created using a ComponentPortal()? If the answer is something generic such as using an Injector, can you please point me to an example or documentation on how to do so? A 'hello world' of passing Injectors?

    Continue reading...

Compartilhe esta Página