When we want the Parent component listens for child event we use the @output parameter and subscribing on the parent markup:
<my-tag (onMyEvent)="onMyEvent($event)"></my-tag>
how do I do it with ComponentResolver?
Output parameters are the parameters that are fetched from the response of a service call. These are formatted according to the attributes you configure for the output before displaying on the device. The service parameters have a scope and data type attached to them.
An Output Parameter allows you to return computed values from an action, process, or process flow element.
What dynamic components are. Dynamic means, that the components location in the application is not defined at buildtime. That means, that it is not used in any angular template. Instead, the component is instantiated and placed in the application at runtime.
That's not supported.
- use a shared service with components that are dynamically added using ViewContainerRef.createComponent()
or
- use the componentRef
it returns to wire inputs and outputs imperatively.
this.resolver.resolveComponent(this.type).then((factory:ComponentFactory<any>) => {
this.cmpRef = this.target.createComponent(factory);
this.cmpRef.instance.someOutput.subscribe(...)
this.cmpRef.instance.someInput = this.someInputValue;
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With