component-injector
Version:
Component Injector service which allows to inject dynamically components into angular2+ projects
2 lines • 1.69 kB
JavaScript
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("component-injector",["exports","@angular/core"],o):o((e=e||self)["component-injector"]={},e.ng.core)}(this,function(e,o){"use strict";var t=function(){function e(e){this.resolver=e}return e.prototype.setComponentFactories=function(o){var t=this;o&&o.forEach(function(o){var n=t.resolver.resolveComponentFactory(o);n&&e.entryComponentsFactories.push(n)})},e.prototype.inject=function(e,o){var t=this.getComponentFactory(o);return t?this.injectComponentFactory(e,t):(console.warn("Component ["+o+"] cannot be found! Make sure it is included in the `entryComponents` list."),null)},e.prototype.setProperties=function(e,o){if(e)for(var t in o)o.hasOwnProperty(t)&&(e.instance[t]=o[t])},e.prototype.remove=function(e){e&&e.destroy(),e=null},e.prototype.getComponentFactory=function(o){var t=e.entryComponentsFactories.find(function(e){return e.selector===o});return t||null},e.prototype.injectComponentFactory=function(e,o){return e.createComponent(o)},e.entryComponentsFactories=[],e.decorators=[{type:o.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:o.ComponentFactoryResolver}]},e.ngInjectableDef=o.ɵɵdefineInjectable({factory:function(){return new e(o.ɵɵinject(o.ComponentFactoryResolver))},token:e,providedIn:"root"}),e}(),n=function(){function e(){}return e.decorators=[{type:o.NgModule,args:[{declarations:[],imports:[],exports:[]}]}],e}();e.ComponentInjector=t,e.ComponentInjectorModule=n,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=component-injector.umd.min.js.map