How to use the ng-dynamic-component.DynamicDirective function in ng-dynamic-component

To help you get started, we’ve selected a few ng-dynamic-component examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wishtack / wishtack-steroids / packages / reactive-component-loader / src / lib / lazy / lazy.directive.ts View on Github external
injector: Injector,
        viewContainerRef: ViewContainerRef
    ) {

        const ngComponentOutlet = this._ngComponentOutlet = new NgComponentOutlet(viewContainerRef);

        /* @HACK: This hack wraps `DynamicDirective` hacks.
         * Creating a fake `ComponentOutletInjectorDirective` that will allow
         * `DynamicDirective` to grab `componentRef` from `NgComponentOutlet`. */
        const componentOutletInjector: any = {
            get componentRef() {
                return ngComponentOutlet['_componentRef'];
            }
        };

        this._dynamicDirective = new DynamicDirective(
            injector,
            injector.get(IoService),
            DynamicComponent as any,
            componentOutletInjector
        );

    }

ng-dynamic-component

> Dynamic components with full life-cycle support for inputs and outputs

MIT
Latest version published 2 years ago

Package Health Score

62 / 100
Full package analysis