-
Notifications
You must be signed in to change notification settings - Fork 0
Type component
Ścibor Rudnicki edited this page May 4, 2017
·
1 revision
Get angular component type
Create component that will use DynamicComponentClass and create new DynamicComponent and use component type instead of any
// default.component.ts
import { Component, ComponentFactoryResolver } from '@angular/core';
import { component, DynamicComponentClass } from '@ngx-core/common';
import { DynamicComponent } from './dynamic.component'
@Component({
selector: 'default-component',
template: '<div #container></div>' // create #container variable
})
export class DefaultComponent extends DynamicComponentClass {
public model = {};
public key = 'notdefined';
constructor(componentFactoryResolver: ComponentFactoryResolver) {
super(componentFactoryResolver);
}
public create(component: component): void { // <--- use component type instead of any
this._create(component);
}
}