Support of get_property in property assignment
[sdc.git] / catalog-ui / src / app / ng2 / services / dynamic-component.service.ts
index 29dd1e9..d530324 100644 (file)
@@ -12,17 +12,15 @@ export class DynamicComponentService {
     //Creates a component dynamically (aka during runtime). If a view container is not specified, it will append the new component to the app root. 
     //To subscribe to an event from invoking component: componentRef.instance.clicked.subscribe((m) => console.log(m.name));
     public createDynamicComponent<T>(componentType: Type<T>, viewContainerRef?:ViewContainerRef): ComponentRef<T> {
-
         viewContainerRef = viewContainerRef || this.getRootViewContainerRef();
         viewContainerRef.clear();
 
-        let factory: ComponentFactory<T> = this.componentFactoryResolver.resolveComponentFactory(componentType); //Ref: https://angular.io/guide/dynamic-component-loader
-        let componentRef: ComponentRef<T> = viewContainerRef.createComponent(factory);
-        return componentRef; 
+        const factory: ComponentFactory<T> = this.componentFactoryResolver.resolveComponentFactory(componentType); //Ref: https://angular.io/guide/dynamic-component-loader
+        return viewContainerRef.createComponent(factory);
     }
 
     
     private getRootViewContainerRef(): ViewContainerRef {
         return this.applicationRef.components[0].instance.viewContainerRef;
     }
-};
\ No newline at end of file
+};